January 2008
33 posts
December 2007
9 posts
Ruby Gotcha: Array#uniq
I wanted to turn this: array_of_hashes = [{"a"=>"5", "b"=>"10", "c"=>"10"}, {"a"=>"5", "b"=>"10", "c"=>"10"}, {"a"=>"5", "b"=>"10", "c"=>"10"}] into: [{"a"=>"5", "b"=>"10", "c"=>"10"}] so I tried something like: array_of_hashes.uniq and it didn’t work so well. It seems that Array#uniq only works if the objects are truly the same, which is definitely a good...
Patch for GChart API ruby lib →
Here’s a patch for John Barnette’s GChart API library which enforces the size limits and also implements all available encodings.
Awesome time-lapse video of one year in Bryant Park in Midtown, NYC.
Being humbled
I always find out how much of a novice I really am when I see code like this: class Reverser def reverse(list) (rec = lambda do |index, result| return result if index == -1 result rec[index - 1, result] end)[list.length-1, []] end end I would have stopped at the second step with the private accumulator. (via)
Infographic-like opening credits of the Kingdom →
I haven’t seen the movie yet but the opening credits look awesome. (via)