Skip to content

Instantly share code, notes, and snippets.

View mpouleijn's full-sized avatar

Michel Pouleijn mpouleijn

View GitHub Profile
@mpouleijn
mpouleijn / deep_fetch.rb
Created January 31, 2012 10:58 — forked from avdi/deep_fetch.rb
Deep Fetch
module DeepFetch
def deep_fetch(*keys, &fetch_default)
throw_fetch_default = fetch_default && lambda {|key, coll|
args = [key, coll]
# only provide extra block args if requested
args = args.slice(0, fetch_default.arity) if fetch_default.arity >= 0
# If we need the default, we need to stop processing the loop immediately
throw :df_value, fetch_default.call(*args)
}
catch(:df_value){
@mpouleijn
mpouleijn / gist:1111490
Created July 28, 2011 12:59
Ruby Style Guide
Original Source: https://github.com/chneukirchen/styleguide
= Christian Neukirchen's Ruby Style Guide
You may not like all rules presented here, but they work very well for
me and have helped producing high quality code. Everyone is free to
code however they want, write and follow their own style guides, but
when you contribute to my code, please follow these rules: