Lambdas in Ruby

I had situation where I worked with many different (but in some way similar) collections in Ruby. This collections had very similar methods to search elements by name. In this particular example I decided to use lambda. Let me show you how this looks like. Code which I get looks like this: @first_collection.select do |activity| activity.name == 'name' end This is not bad code but in others places I had similar things. Collections (I mean arrays) and names were only changes. Like this: @second_collection.select do |activity| activity.name == 'name1' || activity.name == 'name2' end So I decided to use lambda....

Global Game Jam

Date: 2016-01-29 17:00 – 2016-01-31 19:00 Place: Cieszyn, PL I really love doing things connecting in technology. This time I was participant in Global Game Jam in Cieszyn. This was my third time. What is Global Game Jam? This is 48 hours hackathon for people which would like to create games. And each year I’m impressed of ideas, talent and projects realization. You can see more here.

What is git?

If you are interested in IT or you are already a programmer, you should hear the name Git at least a couple of times. Maybe even more. This tool is common to many teams no matter what programming language they use. This is the base and it is good to know git. Today, I would like to start a short series about Git basics. On the Internet, you can find many articles and tutorials about how to use git. I would focus more on what is the purpose of using git and how it works. In this article, I will...

Coderetreat 2015 Cracow

Coderetreat 2015 Cracow

In last Saturday I was on Global Day of Coderetreat in Krakow. Coderetreat is one day in year when programmers focus not on delivery new functionality but focus on good code quality. I think this is very important to stop for a moment and think how to be better programmer. And Coderetreat is that moment.

CoderDojo workshops

Ones a week I’m teaching others at CoderDojo workshops. CoderDojo is a place for young people (not only young by age but also young by mind) which like to learn Computer Science. When I say Computer Science I mean: programming, game and website creation, graphic design, 3D printing, animations, video creation, robots and many many more. Only yours imagination can limit your skills connected to Computer. On this classes is only one rule: Just be cool! CoderDojo is places where everyone feel good and can learn new things.

Be yourself – How deal with low self-confidence

Be who you are, say what you feel, those who mind don’t matter, those who matter don’t mind. Today I would write about very important for me topic. About self-confidence. I don’t know if you have some problems with it but I do. I went through this many times. And I went back to this topic because I change project at my work. About 4 weeks ago I started work on new project (for me of course, because rest of the team work on this project about 2 years). Project has very complex logic. On the beginning I felt like...

Rails Girls Szczecin (22 – 23 August 2015)

This time I won’t be writing about technical things. This time I’d like to share with you something very special for me. Something that brings me lot of joy and happiness. Last weekend I’ve spent as a mentor on Rails Girls in Szczecin. It was my third time. I always have great memories with this place. People are so nice and helpful. The workshop was prepared perfectly. The atmosphere was so positive. If you like to be a part of Rails Girls workshop I truly recommend Szczecin. It’s a great place to start your programming adventure. Ok, I was on...

SessionsController refactoring

A few weeks ago I worked on code like this: class SessionsController < ApplicationController respond_to :json, only: [:create] def create @user = User.find_by(email: user_params[:email]) if @user && @user.authenticate(user_params[:password]) @user.token = Session.create(user: @user).token end respond_to { |format| format.json { render_user } } end private def user_params params.require(:user).permit(:email, :password) end def render_user if @user render json: @user, status: :created else render json: { errors: 'Email or password was invalid' }, status: :unprocessable_entity end end end When you look on this code at first time, you probably think that this is not too bad. Class isn’t to long. It have about 25 lines....