Neo4j, a database storage engine that operates on nodes and "relationships" (edges). Designed for fast traversals of the network.
Mozy Deathmatch II
We're putting on another coding deathmatch this month, April 14th. We've got $20,000 in prizes to give away this time and all it takes is a few hours on a Saturday to participate, so if you live in Utah give it a shot!
Further #to_proc Abuse
Everybody loves to abuse #to_proc. The Symbol#to_proc extension has even been baked in to Ruby 1.9.
Why not continue the duck typing abuse? Let's build a cheap ActiveRecord knock-off for Enumerable:
my_peeps.find_all(&{:last_name => "Palmer"}) appointments.find_all(&{:description => /billable/i, :time => (start_time..end_time)}) my_socks.any?(&{:status => 'washed'})
The implementation is simple.
class Hash; def to_proc proc { |obj| self.inject(true) { |m,(k,v)| m && v === obj.send(k) } } end; end
Of course, I wouldn't try to argue that it's as useful as Symbol#to_proc. Fun to play with, though. I'm using it in a RubyOSA script that I'm building for Colleen. For completeness, this version performs a little better if the hash has many terms and a lot of records will be filtered out:
class Hash; def to_proc proc { |obj| self.inject(nil) { |_,(k,v)| v === obj.send(k) || (break false) } } end; end
Comments? Feedback? Drop me a line.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.