Skip to content

Instantly share code, notes, and snippets.

@ashrewdmint
Created August 5, 2009 04:33
Show Gist options
  • Save ashrewdmint/162504 to your computer and use it in GitHub Desktop.
Save ashrewdmint/162504 to your computer and use it in GitHub Desktop.
# There are some faster ones out there, but I thought this was cute:
class Array
def duplicates
self.reject {|item| self.select {|sibling| sibling == item}.length == 1}.uniq
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment