Add custom repositories snippet

`each_with_index` is better than manually doing `i = 0`, `i += 1`. I just checked and it's present in Ruby 1.8.7.

Other than that, visual ACK. If we're pressed for time on other tasks we don't need to fix that ^, it's a detail.