Skip to content

Instantly share code, notes, and snippets.

@vinniefranco
Created January 17, 2012 05:59
Show Gist options
  • Save vinniefranco/1625078 to your computer and use it in GitHub Desktop.
Save vinniefranco/1625078 to your computer and use it in GitHub Desktop.
# Cool shit about Ruby
# Arrays
array1, array2 = %w{ x y z }, %w{ w y z }
array1 | array2 ###(Union) #=> ["x", "y", "z", "w"]
array1 & array2 ###(Intersect) #=> ["y", "z"]
array1 - array2 ###(Difference) #=> ["x"]
# Strings
str = %{I'd like to invite you to the pants party}
str['to the pants'] = %{80's}
# Chicks love 80's parties.
str #=> "I'd like to invite you 80's party"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment