Dev box
I'm a 32-year-old Ruby on Rails web developer. With the help of friends and co-workers, I've been teaching myself Rails. I worked as a Rails developer for Crowd911 in Colorado. I live in Berlin.
In my developer blog I publish a stochastic array of thoughts and ideas, lessons, mistakes, questions and attempts as answers about Rails and Ruby. I am also posting Anki cards that I used to help myself study. In my view most knowledge is about practice. If you have thoughts, questions, ideas, corrections, arguments, feel free to email me at

Converting in Ruby between strings and symbols




(.intern is the same as .to_sym)

Read More

Ruby Hashes - including "hash constructors"

Ohne titel


When you create a hash from the „hash constructor“ - i.e. simply new_hash = — just remember that you’re doing the exact same thing as new_hash = { „one“ => 1 }.

With new_hash =, you are literally just… creating an instance of a Class (Hash) that already exists in Ruby!!  And assigning your own data to it!!!  

When you iterate over Hashes, remember you have keys and values, so the iterator needs to have those  separated.  Say, for example, you only want to print the value.  

BUT there are also actually specific hash .each methods to cover these situations:



Read More

Ruby, memory use, and garbage collection

Ruby is a garbage-collecting language.  Garbage collection has to do with memory. That’s the reason that String IDs change.  Ruby is constantly cleaning up the memory of unused strings during the duration of the program.  Also, anytime the whole program ends, everything, all IDs, etc., are deleted from the program.

Read More

Blocks are methods without names

Blocks are methods without names.  It is just a bit of code between do..end or { }. It can be passed to methods like .each or .select.

You CAN set a variable to a block, e.g.

doubled_fibs = |number| do 

number * 2



But just keep in mind that the block doesn’t go on living as a separate item by itself, it’s just a piece of code that does something, that you happen to have set to a variable.  It’s not like a method or a proc where it’s saved and can be reused. 

A related tangent: Methods don’t need classes!

Think about it… methods don’t need classes all the time.  Sometimes, you have a method that just stands alone.

You use classes to organize bundles of methods, and to create objects that automatically are imbued with the ability to call the bundle of methods.

To pass a block to a method, you simply type the method and then the block.  For example:

greet       { puts „Hi!“ }

If the method has parameters, then you place it first: 

verbose_greet(„Dave“, „loyal customer“)  {puts „Hi!“}

Read More

Git – How to set up a remote repository


There is a great deal of documentation and many posts on Git out there, so this is more of a note to self as I keep forgetting the steps needed to set up a remote repository and doing an initial “push”.

So, firstly setup the remote repository:

on, go to 

On local machine:

cd my_project

git init

git add .

git commit -m "My initial commit message"

git remote add origin

git push -u origin master


Team members can now clone and track the remote repository using the following:

git clone

cd my_project


To have your terminal prompt display what branch you are currently on in green, add the following to your ~/.bash_profile (I have my current directory displayed in cyan):

function git-branch-name {

  git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3


function git-branch-prompt {

  local branch=`git-branch-name`

  if [ $branch ]; then printf " [%s]" $branch; fi



PS1="\u@\h \[\033[0;36m\]\W\[\033[0m\]\[\033[0;32m\]\$(git-branch-prompt)\[\033[0m\] \$ "


Resource I used for this post:

Read More