Category Archives: Uncategorized

The video upload marks the spot.

It’s about time I write on this thing since it has been months since my last post. I was sifting through some old code I’d written last year and I tell you what, sometimes I’m actually shocked at the things … Continue reading

Posted in Uncategorized | Leave a comment

When you get really bored, and want to find a problem for this solution:

Getting the intersection and lowest values of a hash. def hash_intersect_min(*hashes) hashes.inject(hashes.pop.dup) { |i,h| i.delete_if { |k,v| hv=h[k]; next true unless hv; i[k]=hv if hv<v; false }; i } end So the following: hash_intersect_min({:a => 1, :d => 2, :k … Continue reading

Posted in Uncategorized | Leave a comment

HA! “Uniq” Arrays Can’t Fool Me

In Ruby, when you have an array and need a subset of the unique elements of that array, you can easily call array.uniq — woohoo. However, what if your array looks something like ["hi", "HI", "bye", "BYE"] and you want … Continue reading

Posted in Uncategorized | Leave a comment