Skip to content

Instantly share code, notes, and snippets.

@vijaydev
Created January 5, 2011 20:20
Show Gist options
  • Save vijaydev/766944 to your computer and use it in GitHub Desktop.
Save vijaydev/766944 to your computer and use it in GitHub Desktop.
Ruby
"ensure" makes sure code is run regardless of begin-rescue outcome. (equivalent of Java finally)
Pass a number parameter to Array#first and Array#last to get the first n or the last n values.
http://rubyquicktips.tumblr.com/post/870337608/grep-anything-from-your-enumerables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment