Skip to content

Instantly share code, notes, and snippets.

@bmarini
Created February 17, 2010 16:26
Show Gist options
  • Save bmarini/306771 to your computer and use it in GitHub Desktop.
Save bmarini/306771 to your computer and use it in GitHub Desktop.
class Hash
def map
inject({}) { |memo,(k,v)| memo[k] = yield(v); memo }
end
end
def past(interval)
interval.map { |v| v.abs * -1 }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment