Skip to content

Instantly share code, notes, and snippets.

@PatrickTulskie
Created May 14, 2009 05:57
Show Gist options
  • Save PatrickTulskie/111514 to your computer and use it in GitHub Desktop.
Save PatrickTulskie/111514 to your computer and use it in GitHub Desktop.
class Array
def antiuniq
duplicates = []
clone = [] + self
while clone.length > 0
item = clone.pop
duplicates.push(item) if clone.include?(item) || duplicates.include?(item)
end
return duplicates
end
def antiuniq!
self.replace antiuniq
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment