Love, caffeine and omlette

Month: September 2012

tig - a nice git repository browser

A colleague just recommended tig to me.


You can install tig with the packetmanager of your choice.

After you start tig in your project, you see a list of the last commits and can browse through them using your arrow key or the good old vim style (with j, k).

If you hit enter you can inspect the commit in question.

The other nice feature for me is: if you hit "t" you can browse through the tree of files in the project. With "B" you can see do a git blame on for a specific file.


tig has many more features - just press "h" to get a list of all of them, but for me these are the two killer features.

tig works better then Tower, Gitbox, or GitK, because I do not need to leave the command line.

If you are interested, visit the tig website and give it a try.

Script to disable internet connectivity for Mac OS X

From time to time I really want make it hard for me to seek for distractions.

I found myself using the nice Mac OS X tool Freedom all the time. Freedom disables the network connectivity, which means no Twitter, Facebook etc.

But when I revisited the site I found that the author now charges 10$ for it - Thats just a little bit to expensive in my opinion.

So I went out and it took me 5 minutes to come up with

echo "Enough of this filthy internet" | cowsay -s
sudo route -n delete default &> /dev/null

Cowsay required. (If you don't want to install cowsay just remove the line!)

< Enough of this filthy internet >
            (__)       )/
             U  ||----w |
                ||     ||

To reenable your internet you have to add back the default route or restart your computer.

Lessons from the prime factorization dojo

Last week my colleagues at and I had our second
Coding Dojo.

I learned a important lessons - even though this wasn't the first time I practiced the kata.

The kata

The task was to create a class that decomposes natural numbers into its
prime factors.

Additionally the factors should be sorted ascending.


1  => [] # Since 1 is no prime ;)
5  => [5]
10 =>       [2,5]
75 => [3,5,5]

You get the idea 😉

This sounds simple and like a perfect candidate for an
introduction to TDD right?

Unfortunately this kata is a bit tricky.

Performing the kata

The first tests are straightforward:

module PrimeFactorDecomposer  
  def decompose(number)
    if number < 4
describe PrimeFactorDecomposer do  
    include PrimeFactorDecomposer

     it "returns no prime factors for 1" do
    decompose(1).should be_empty

  it "decomposes 2 into 2" do
    decompose(2).should be == [2]

  it "decomposes 3 into 3" do
    decompose(3).should be == [3]

  it "decomposes 4 into 2,2" do
    decompose(4).should be == [2,2]

Now the trouble begins

Now decomposing 5 would be a nice test? Right? Since 5 is a prime it
would only return 5. But how can we find out if its a prime?

So we could write a function that finds out if 5 is prime. Hm that seems

What about 6? But then we have to develop a algorithm that works -
otherwise we would just move sidewards and add conditionals.

Whats the problem?

You do not know how to solve the problem. Not everything is as simple as
the FizzBuzz Kata.

Adding another test alone does not suffice. It's a common hurdle for
newcomers to TDD.

How to solve this?

Grab a sheet of paper and think about the algorithm. Or do a little spike until you fully understand the
problem. Sometimes it's just not true, that a design "magically" emerges.


You need a sound knowledge about where to go - otherwise you will have problems with TDD along the way. Then you have to lean back and think a little bit or get feedback from something else then your tests.

TDD is cool, but it can not solve every problem. Especially not complicated algorithms (this is a really easy one of course).

Another personal learning for me was to watch myself better, when I do a kata the first time.

When the design does not emerge from the tests - I should listen to them. Maybe they want to tell me that I have absolutely no idea what I am doing and that I need to think more..

Ruby Tapas

I am quite exited about Avdi Grimm's new project Ruby Tapas.

3 times a week Avdi post short videos about different concepts and techniques in Ruby.

The first 3 episodes were short, but I already learned some obscure details of Ruby that I didn't know about.

I think that over many weeks, that should give me a pretty solid knowledge of the parts of Ruby that I do not touch in my daily work.

© 2017

Theme by Anders NorenUp ↑