Skip to content

Instantly share code, notes, and snippets.

@darthschmoo
Created January 10, 2014 18:09
Show Gist options
  • Save darthschmoo/8359447 to your computer and use it in GitHub Desktop.
Save darthschmoo/8359447 to your computer and use it in GitHub Desktop.
Ruby code: If anyone needs help generating their Amazon AuthorRank for the day.
module ChuckWendig
class AuthorRankGenerator
def initialize
@mood = %w(belated confused morose unwell insipid thoughtful incontinent chewy bratty arrogant untrustworthy
awestruck inebriated love-starved overwrought merciful doubtful analytical self-assured simplistic
enraged melancholy lustful depressed)
@descriptor = %w(fighting dancing stammering boiling endearing staggered judicious internal heat-loving
ragtime kleptomaniacal torrential climate-changing self-help razor-edged killer caffeinated
pugilistic bitcoin luddite libertarian progressive leftist right-wing patriotic unpatriotic
slamdancing fictional authoritarian dilapidated)
@noun = %w(cormorant wendigo ocelot thunderbolt lumberjack barista turkey zebra sociopath CEO dolphin trilobite
monopolist enforcer privateer mercenary pacifist enthusiast dragon zeppelin quetzalcoatl titan
longshoreman mafiosa yak wildebeest groundhog octopus squid brachiosaur velociraptor retrovirus
triceratops aphid dictator bunyip proletariat ballerina senator)
end
def rank
[@mood, @descriptor, @noun].map{ |arr|
arr[ rand( arr.length ) ]
}.map(&:capitalize).join(" ")
end
end
end
# Example code follows
r = ChuckWendig::AuthorRankGenerator.new
100.times do
puts r.rank
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment