Created
June 9, 2012 03:42
-
-
Save solomon081/2899304 to your computer and use it in GitHub Desktop.
GID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GID | |
# Filters out naughty words | |
def self.filter! str | |
words = ["fuck", "shit", "bitch", "cunt", "fag", "douche", "ass", "a55", "b1tch", "f4g", "5h1t"] | |
substitutes = ["faxf", "spwo", "bawpr", "capf", "fpa", "dclax", "aic", "a21", "b5sea", "f8m", "1z8l"] | |
words.each do |x| | |
str.gsub!(x, substitutes[words.index(x)]) | |
end | |
return str | |
end | |
# Generates a new GID | |
def self.generate length=32, lean=String | |
str = "" | |
letters = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] | |
types = [Fixnum, String] | |
types.push(lean) | |
length.times do | |
if types.sample == Fixnum | |
str << "#{rand(10)}" | |
else | |
str << letters.sample | |
end | |
end | |
filter! str | |
return str | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment