Skip to content

Instantly share code, notes, and snippets.

@spadgos
Forked from anonymous/random-task.js
Last active March 21, 2018 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spadgos/43a0a5af03cc1c084ab9b32a6694474a to your computer and use it in GitHub Desktop.
Save spadgos/43a0a5af03cc1c084ab9b32a6694474a to your computer and use it in GitHub Desktop.
Output a list of random task titles
javascript:(function()%7Bconst adverbs %3D %5B'abruptly'%2C 'actively'%2C 'badly'%2C 'beautifully'%2C'briskly'%2C 'brutally'%2C 'carefully'%2C 'cheerfully'%2C'circularly'%2C 'clearly'%2C 'collectively'%2C 'comfortably'%2C'considerably'%2C 'continuously'%2C 'courageously'%2C 'crazily'%2C'creatively'%2C 'creditably'%2C 'dangerously'%2C 'delicately'%2C'delightfully'%2C 'destructively'%2C 'differently'%2C 'endlessly'%2C'enviously'%2C 'eternally'%2C 'expectedly'%2C 'expertly'%2C'financially'%2C 'firmly'%2C 'forcefully'%2C 'gloriously'%2C'growingly'%2C 'harmfully'%2C 'hatefully'%2C 'healthily'%2C'hopefully'%2C 'imitatively'%2C 'impressively'%2C 'inclusively'%2C'indicatively'%2C 'injuriously'%2C 'insultingly'%2C 'intentionally'%2C'irritatingly'%2C 'leadingly'%2C 'lightly'%2C 'livingly'%2C'madly'%2C 'massively'%2C 'monotonously'%2C 'movingly'%2C'powerfully'%2C 'quickly'%2C 'randomly'%2C 'sadly'%2C'securely'%2C 'sloppily'%2C 'sorrowfully'%2C 'speedily'%2C'truthfully'%2C 'uneasily'%2C 'wearily'%2C 'weirdly'%2C'wholeheartedly'%2C 'wickedly'%2C 'willfully'%2C%5D%3Bconst verbs %3D %5B'accept'%2C 'adjust'%2C 'admire'%2C 'advise'%2C 'amaze'%2C 'amuse'%2C 'annoy'%2C 'approach'%2C'attend'%2C 'attract'%2C 'avoid'%2C 'believe'%2C 'blacken'%2C 'bore'%2C 'bother'%2C'breathe'%2C 'bury'%2C 'care'%2C 'challenge'%2C 'chase'%2C 'cheer'%2C 'choose'%2C 'clear'%2C'collect'%2C 'comfort'%2C 'confuse'%2C 'consider'%2C 'console'%2C 'create'%2C 'cure'%2C'curse'%2C 'damage'%2C 'deafen'%2C 'decorate'%2C 'delight'%2C 'destroy'%2C 'develop'%2C'disturb'%2C 'dust'%2C 'educate'%2C 'embarrass'%2C 'empower'%2C 'empty'%2C 'encircle'%2C 'encourage'%2C'endanger'%2C 'enthuse'%2C 'enumerate'%2C 'explain'%2C 'explore'%2C 'fascinate'%2C 'feed'%2C 'force'%2C'glorify'%2C 'harm'%2C 'hate'%2C 'heal'%2C 'identify'%2C 'imitate'%2C 'impress'%2C'include'%2C 'inform'%2C 'injure'%2C 'instruct'%2C 'insult'%2C 'introduce'%2C 'invent'%2C'irritate'%2C 'launch'%2C 'lead'%2C 'madden'%2C 'modernise'%2C 'moisten'%2C 'move'%2C 'observe'%2C'perform'%2C 'permit'%2C 'persuade'%2C 'please'%2C 'popularise'%2C 'quicken'%2C 'redden'%2C'sadden'%2C 'secure'%2C 'see'%2C 'tickle'%2C 'whiten'%2C%5D%3Bconst adjectives %3D %5B'acceptable'%2C 'achievable'%2C 'active'%2C 'additional'%2C 'adjustable'%2C 'admirable'%2C 'advisable'%2C 'alive'%2C'amazing'%2C 'amusing'%2C 'annoying'%2C 'approachable'%2C 'attentive'%2C 'attractive'%2C 'avoidable'%2C 'bad'%2C'believable'%2C 'boring'%2C 'careful'%2C 'cheerful'%2C 'circular'%2C 'collective'%2C 'comfortable'%2C'complex'%2C 'confused'%2C 'considerable'%2C 'continuous'%2C 'courageous'%2C 'crazy'%2C 'creative'%2C'creditable'%2C 'curable'%2C 'cursed'%2C 'damaged'%2C 'dangerous'%2C 'dead'%2C 'deaf'%2C 'decisive'%2C'decorative'%2C 'delightful'%2C 'demanding'%2C 'derivative'%2C 'deserving'%2C 'destructive'%2C 'different'%2C 'disturbing'%2C'dusty'%2C 'educative'%2C 'embarrassing'%2C 'empty'%2C 'enthusiastic'%2C 'envious'%2C 'evaporating'%2C 'expected'%2C'explainable'%2C 'exploring'%2C 'fascinating'%2C 'firm'%2C 'flying'%2C 'forceful'%2C 'glorious'%2C 'growing'%2C'harmful'%2C 'hateful'%2C 'healthy'%2C 'hopeful'%2C 'imitative'%2C 'impressive'%2C 'inclusive'%2C 'indentified'%2C'indentifying'%2C 'indicative'%2C 'informative'%2C 'inhabitant'%2C 'injurious'%2C 'innumerable'%2C 'inquiring'%2C 'instructive'%2C 'insulting'%2C'intentional'%2C 'interfering'%2C 'introductory'%2C 'inventive'%2C 'irritating'%2C 'leading'%2C 'lively'%2C 'lost'%2C'mad'%2C 'massive'%2C 'migrating'%2C 'modern'%2C 'moistures'%2C 'monotonous'%2C 'movable'%2C 'narrow'%2C'numerable'%2C 'performing'%2C 'permissible'%2C 'persuasive'%2C 'pleasant'%2C 'popular'%2C 'powerful'%2C'quick'%2C 'sad'%2C 'scenic'%2C 'speedy'%2C%5D%3Bconst animals %3D %5B'aardvarks'%2C 'aardwolves'%2C 'african buffalos'%2C 'african elephants'%2C 'african leopards'%2C 'african wild dogs'%2C 'albatrosses'%2C 'alligators'%2C'alpacas'%2C 'american black bears'%2C 'american buffalos'%2C 'american robins'%2C 'amphibians'%2C 'anacondas'%2C 'angelfishes'%2C 'anglerfishes'%2C'ants'%2C 'anteaters'%2C 'antelopes'%2C 'antlions'%2C 'apes'%2C 'aphids'%2C 'arabian leopards'%2C 'arctic foxes'%2C'arctic wolves'%2C 'armadillos'%2C 'arrow crabs'%2C 'asian black bears'%2C 'asps'%2C 'axolotls'%2C 'baboons'%2C 'badgers'%2C'bald eagles'%2C 'bandicoots'%2C 'barnacles'%2C 'barracudas'%2C 'basilisks'%2C 'basses'%2C 'bats'%2C 'beaked whales'%2C'bears'%2C 'beavers'%2C 'bedbugs'%2C 'bees'%2C 'beetles'%2C 'birds'%2C 'bisons'%2C 'blackbirds'%2C'black panthers'%2C 'black widow spiders'%2C 'blue birds'%2C 'blue jays'%2C 'blue whales'%2C 'boas'%2C 'boars'%2C 'bobcats'%2C'bobolinks'%2C 'bonobos'%2C 'boobys'%2C 'box jellyfishes'%2C 'bovids'%2C 'buffalos'%2C 'brown bears'%2C 'bugs'%2C'bulls'%2C 'butterflys'%2C 'buzzards'%2C 'camels'%2C 'canada geese'%2C 'canids'%2C 'cape buffalos'%2C 'capybaras'%2C'cardinals'%2C 'caribous'%2C 'carps'%2C 'cats'%2C 'catsharks'%2C 'caterpillars'%2C 'catfishes'%2C 'cattles'%2C'centipedes'%2C 'cephalopods'%2C 'chameleons'%2C 'cheetahes'%2C 'chickadees'%2C 'chickens'%2C 'chimpanzees'%2C 'chinchillas'%2C'chipmunks'%2C 'coatis'%2C 'cicadas'%2C 'clams'%2C 'clownfishes'%2C 'cobras'%2C 'cockroaches'%2C 'cods'%2C'condors'%2C 'constrictors'%2C 'corals'%2C 'cougars'%2C 'cows'%2C 'coyotes'%2C 'coypus'%2C 'crabs'%2C'cranes'%2C 'crane flys'%2C 'crawdads'%2C 'crayfishes'%2C 'crickets'%2C 'crocodiles'%2C 'crows'%2C 'cuckoos'%2C'damselflys'%2C 'deers'%2C 'dholes'%2C 'dingos'%2C 'dinosaurs'%2C 'dodos'%2C 'dogs'%2C 'dolphins'%2C'donkeys'%2C 'dormice'%2C 'doves'%2C 'dragonflys'%2C 'dragons'%2C 'ducks'%2C 'dung beetles'%2C 'eagles'%2C'earthworms'%2C 'earwigs'%2C 'echidnas'%2C 'eels'%2C 'egrets'%2C 'elephants'%2C 'elephant seals'%2C 'elks'%2C'emus'%2C 'english pointers'%2C 'ermines'%2C 'falcons'%2C 'ferrets'%2C 'fennecs'%2C 'finches'%2C 'fireflys'%2C'fishes'%2C 'flamingos'%2C 'fleas'%2C 'flys'%2C 'flyingfishes'%2C 'fowls'%2C 'foxes'%2C 'frogs'%2C'fruit bats'%2C 'flying squirrels'%2C 'gamefowls'%2C 'galliforms'%2C 'gazelles'%2C 'geckos'%2C 'gerbils'%2C 'giant pandas'%2C'giant squids'%2C 'gibbons'%2C 'gila monsters'%2C 'giraffes'%2C 'goats'%2C 'golden eagles'%2C 'goldfishes'%2C 'geese'%2C'gophers'%2C 'gorillas'%2C 'grasshoppers'%2C 'great blue herons'%2C 'great white sharks'%2C 'grebes'%2C 'grizzly bears'%2C 'ground sharks'%2C'ground sloths'%2C 'grouses'%2C 'guans'%2C 'guanacos'%2C 'guineafowls'%2C 'guinea pigs'%2C 'gulls'%2C 'guppys'%2C'haddocks'%2C 'halibuts'%2C 'hammerhead sharks'%2C 'hamsters'%2C 'hares'%2C 'harriers'%2C 'hawks'%2C 'hedgehogs'%2C'hermit crabs'%2C 'herons'%2C 'herrings'%2C 'hippopotamuses'%2C 'hookworms'%2C 'hornets'%2C 'horses'%2C 'hoverflys'%2C'humans'%2C 'hummingbirds'%2C 'humpback whales'%2C 'hyenas'%2C 'hyraxes'%2C 'iguanas'%2C 'ibises'%2C 'indian ring necks'%2C'jackals'%2C 'jacanas'%2C 'jaguars'%2C 'jays'%2C 'jellyfishes'%2C 'judahes'%2C 'jungle fowls'%2C 'kangaroos'%2C'kangaroo mice'%2C 'kangaroo rats'%2C 'kingfishers'%2C 'kites'%2C 'kiwis'%2C 'koalas'%2C 'kois'%2C 'komodo dragons'%2C'krills'%2C 'ladybugs'%2C 'lampreys'%2C 'landfowls'%2C 'land snails'%2C 'lapwings'%2C 'larks'%2C 'leeches'%2C'lemmings'%2C 'lemurs'%2C 'leopards'%2C 'leopons'%2C 'limpets'%2C 'lions'%2C 'lionfishes'%2C 'lizards'%2C'llamas'%2C 'lobsters'%2C 'locusts'%2C 'loons'%2C 'lorises'%2C 'louses'%2C 'lungfishes'%2C 'lynxes'%2C'macaws'%2C 'mackerels'%2C 'magpies'%2C 'mallards'%2C 'mammals'%2C 'manatees'%2C 'mandrills'%2C 'manta rays'%2C'marlins'%2C 'marmosets'%2C 'marmots'%2C 'marsupials'%2C 'martens'%2C 'mastodons'%2C 'mayas'%2C 'meadowlarks'%2C'meerkats'%2C 'megamouth sharks'%2C 'minks'%2C 'minnows'%2C 'mites'%2C 'mockingbirds'%2C 'moles'%2C 'mollusks'%2C'mongeese'%2C 'monitor lizards'%2C 'monkeys'%2C 'mooses'%2C 'mosquitos'%2C 'mothes'%2C 'mountain goats'%2C 'mice'%2C'mules'%2C 'muskoxes'%2C 'narwhals'%2C 'needlefishes'%2C 'newts'%2C 'new world quails'%2C 'nighthawks'%2C 'nightingales'%2C'nile crocodiles'%2C 'numbats'%2C 'ocelots'%2C 'octopuses'%2C 'okapis'%2C 'old world quails'%2C 'olingos'%2C 'opossums'%2C'orangutans'%2C 'orcas'%2C 'oribis'%2C 'ostriches'%2C 'otters'%2C 'owls'%2C 'owl-faced monkeys'%2C 'oxes'%2C'pandas'%2C 'panthers'%2C 'panthera hybrids'%2C 'parakeets'%2C 'parrots'%2C 'parrotfishes'%2C 'partridges'%2C 'peacocks'%2C'peafowls'%2C 'pelicans'%2C 'penguins'%2C 'perches'%2C 'peregrine falcons'%2C 'pheasants'%2C 'pigs'%2C 'pigeons'%2C'pikes'%2C 'pilot whales'%2C 'pinnipeds'%2C 'piranhas'%2C 'planarians'%2C 'platypuses'%2C 'polar bears'%2C 'ponys'%2C'porcupines'%2C 'porpoises'%2C 'portuguese man o%5C' wars'%2C 'possums'%2C 'prairie dogs'%2C 'prawns'%2C 'praying mantises'%2C 'primates'%2C'ptarmigans'%2C 'puffins'%2C 'pumas'%2C 'pythons'%2C 'quails'%2C 'queleas'%2C 'quetzals'%2C 'quokkas'%2C'rabbits'%2C 'raccoons'%2C 'rainbow trouts'%2C 'rats'%2C 'rattlesnakes'%2C 'ravens'%2C 'rays'%2C 'rays'%2C'red deers'%2C 'red foxes'%2C 'red pandas'%2C 'red squirrels'%2C 'reindeers'%2C 'reptiles'%2C 'rhinoceroses'%2C 'right whales'%2C'roadrunners'%2C 'rodents'%2C 'rooks'%2C 'roosters'%2C 'roundworms'%2C 'saber-toothed cats'%2C 'sailfishes'%2C 'salamanders'%2C'salmons'%2C 'sawfishes'%2C 'scale insects'%2C 'scallops'%2C 'scorpions'%2C 'seahorses'%2C 'sea lions'%2C 'sea slugs'%2C'sea snails'%2C 'servals'%2C 'sharks'%2C 'sheeps'%2C 'shrews'%2C 'shrimps'%2C 'silkworms'%2C 'silverfishes'%2C'skinks'%2C 'skunks'%2C 'sloths'%2C 'slugs'%2C 'smelts'%2C 'snails'%2C 'snakes'%2C 'snipes'%2C'snow leopards'%2C 'sockeye salmons'%2C 'soles'%2C 'sparrows'%2C 'sperm whales'%2C 'spiders'%2C 'spider monkeys'%2C 'spoonbills'%2C'squids'%2C 'squirrels'%2C 'starfishes'%2C 'star-nosed moles'%2C 'steelhead trouts'%2C 'stingrays'%2C 'stoats'%2C 'storks'%2C'sturgeons'%2C 'sugar gliders'%2C 'swallows'%2C 'swans'%2C 'swifts'%2C 'swordfishes'%2C 'swordtails'%2C 'tahrs'%2C'takins'%2C 'tapirs'%2C 'tarantulas'%2C 'tarsiers'%2C 'tasmanian devils'%2C 'termites'%2C 'terns'%2C 'thrushes'%2C'ticks'%2C 'tigers'%2C 'tiger sharks'%2C 'tiglons'%2C 'titis'%2C 'toads'%2C 'tortoises'%2C 'toucans'%2C'trapdoor spiders'%2C 'tree frogs'%2C 'trouts'%2C 'tunas'%2C 'turkeys'%2C 'turtles'%2C 'tyrannosauruses'%2C 'urials'%2C'unicorns'%2C 'vampire bats'%2C 'vampire squids'%2C 'vaquitas'%2C 'vicuñas'%2C 'vipers'%2C 'vixens'%2C 'voalavoanalas'%2C'voles'%2C 'vultures'%2C 'wallabys'%2C 'walruses'%2C 'wasps'%2C 'warblers'%2C 'waterbucks'%2C 'water buffalos'%2C'water chevrotains'%2C 'weasels'%2C 'whales'%2C 'whippets'%2C 'whitefishes'%2C 'white rhinoceroses'%2C 'whooping cranes'%2C 'wild boars'%2C'wildcats'%2C 'wildebeests'%2C 'wildfowls'%2C 'wolves'%2C 'wolverines'%2C 'wombats'%2C 'wood lemmings'%2C 'woodchucks'%2C'woodpeckers'%2C 'woolly dormice'%2C 'woolly hares'%2C 'worms'%2C 'wrens'%2C 'xerinaes'%2C 'x-ray fishes'%2C 'yaks'%2C'yellow perches'%2C 'zebras'%2C 'zebra finches'%2C 'zebra sharks'%2C 'zebus'%2C 'zorillas'%2C 'zanj sun squirrels'%2C 'zaphir%5C's shrews'%2C'zarudny%5C's jirds'%2C 'zarudny%5C's rock shrews'%2C 'zebra duikers'%2C 'zempoaltepec deer mice'%2C 'zempoaltépec voles'%2C 'zenker%5C's fruit bats'%2C 'zuniga%5C's dark rice rats'%2C%5D%3Bfunction pickRandom(arr) %7Breturn arr%5BMath.floor(Math.random() * arr.length)%5D%3B%7Dfunction maybePickRandom(arr) %7Breturn Math.random() < 0.5 %3F pickRandom(arr) %3A null%3B%7Dfunction pickUpTo(arr%2C n) %7Bconst out %3D %5B%5D%3Bfor (let i %3D 0%3B i < n%3B %2B%2Bi) %7Bconst word %3D maybePickRandom(arr)%3Bif (word %26%26 !out.includes(word)) %7Bout.push(word)%3B%7D%7Dif (out.length < 2) %7Breturn out.join('')%3B%7D else %7Breturn out.slice(0%2C -1).join('%2C ') %2B ' and ' %2B out.slice(-1)%5B0%5D%3B%7D%7Dfunction capitalize(str) %7Breturn str%5B0%5D.toUpperCase() %2B str.slice(1)%3B%7Dconst count %3D (typeof process !%3D%3D 'undefined' %26%26 parseInt(process.argv%5B2%5D%2C 10)) %7C%7C 20%3Bconst output %3D (new Array(count)).fill('').map(() %3D> %7Breturn %5BpickUpTo(adverbs%2C 2)%2C pickRandom(verbs)%2C pickUpTo(adjectives%2C 3)%2C pickRandom(animals)%5D.filter(Boolean).join(' ')%3B%7D).map(capitalize).sort().join('%5Cn')%3Bconsole.log(output)%7D)()
// usage: node random-task.js [numPhrasesToGenerate]
const adverbs = [
'abruptly', 'actively', 'badly', 'beautifully',
'briskly', 'brutally', 'carefully', 'cheerfully',
'circularly', 'clearly', 'collectively', 'comfortably',
'considerably', 'continuously', 'courageously', 'crazily',
'creatively', 'creditably', 'dangerously', 'delicately',
'delightfully', 'destructively', 'differently', 'endlessly',
'enviously', 'eternally', 'expectedly', 'expertly',
'financially', 'firmly', 'forcefully', 'gloriously',
'growingly', 'harmfully', 'hatefully', 'healthily',
'hopefully', 'imitatively', 'impressively', 'inclusively',
'indicatively', 'injuriously', 'insultingly', 'intentionally',
'irritatingly', 'leadingly', 'lightly', 'livingly',
'madly', 'massively', 'monotonously', 'movingly',
'powerfully', 'quickly', 'randomly', 'sadly',
'securely', 'sloppily', 'sorrowfully', 'speedily',
'truthfully', 'uneasily', 'wearily', 'weirdly',
'wholeheartedly', 'wickedly', 'willfully',
];
const verbs = [
'accept', 'adjust', 'admire', 'advise', 'amaze', 'amuse', 'annoy', 'approach',
'attend', 'attract', 'avoid', 'believe', 'blacken', 'bore', 'bother',
'breathe', 'bury', 'care', 'challenge', 'chase', 'cheer', 'choose', 'clear',
'collect', 'comfort', 'confuse', 'consider', 'console', 'create', 'cure',
'curse', 'damage', 'deafen', 'decorate', 'delight', 'destroy', 'develop',
'disturb', 'dust', 'educate', 'embarrass', 'empower', 'empty', 'encircle', 'encourage',
'endanger', 'enthuse', 'enumerate', 'explain', 'explore', 'fascinate', 'feed', 'force',
'glorify', 'harm', 'hate', 'heal', 'identify', 'imitate', 'impress',
'include', 'inform', 'injure', 'instruct', 'insult', 'introduce', 'invent',
'irritate', 'launch', 'lead', 'madden', 'modernise', 'moisten', 'move', 'observe',
'perform', 'permit', 'persuade', 'please', 'popularise', 'quicken', 'redden',
'sadden', 'secure', 'see', 'tickle', 'whiten',
];
const adjectives = [
'acceptable', 'achievable', 'active', 'additional', 'adjustable', 'admirable', 'advisable', 'alive',
'amazing', 'amusing', 'annoying', 'approachable', 'attentive', 'attractive', 'avoidable', 'bad',
'believable', 'boring', 'careful', 'cheerful', 'circular', 'collective', 'comfortable',
'complex', 'confused', 'considerable', 'continuous', 'courageous', 'crazy', 'creative',
'creditable', 'curable', 'cursed', 'damaged', 'dangerous', 'dead', 'deaf', 'decisive',
'decorative', 'delightful', 'demanding', 'derivative', 'deserving', 'destructive', 'different', 'disturbing',
'dusty', 'educative', 'embarrassing', 'empty', 'enthusiastic', 'envious', 'evaporating', 'expected',
'explainable', 'exploring', 'fascinating', 'firm', 'flying', 'forceful', 'glorious', 'growing',
'harmful', 'hateful', 'healthy', 'hopeful', 'imitative', 'impressive', 'inclusive', 'indentified',
'indentifying', 'indicative', 'informative', 'inhabitant', 'injurious', 'innumerable', 'inquiring', 'instructive', 'insulting',
'intentional', 'interfering', 'introductory', 'inventive', 'irritating', 'leading', 'lively', 'lost',
'mad', 'massive', 'migrating', 'modern', 'moistures', 'monotonous', 'movable', 'narrow',
'numerable', 'performing', 'permissible', 'persuasive', 'pleasant', 'popular', 'powerful',
'quick', 'sad', 'scenic', 'speedy',
];
const animals = [
'aardvarks', 'aardwolves', 'african buffalos', 'african elephants', 'african leopards', 'african wild dogs', 'albatrosses', 'alligators',
'alpacas', 'american black bears', 'american buffalos', 'american robins', 'amphibians', 'anacondas', 'angelfishes', 'anglerfishes',
'ants', 'anteaters', 'antelopes', 'antlions', 'apes', 'aphids', 'arabian leopards', 'arctic foxes',
'arctic wolves', 'armadillos', 'arrow crabs', 'asian black bears', 'asps', 'axolotls', 'baboons', 'badgers',
'bald eagles', 'bandicoots', 'barnacles', 'barracudas', 'basilisks', 'basses', 'bats', 'beaked whales',
'bears', 'beavers', 'bedbugs', 'bees', 'beetles', 'birds', 'bisons', 'blackbirds',
'black panthers', 'black widow spiders', 'blue birds', 'blue jays', 'blue whales', 'boas', 'boars', 'bobcats',
'bobolinks', 'bonobos', 'boobys', 'box jellyfishes', 'bovids', 'buffalos', 'brown bears', 'bugs',
'bulls', 'butterflys', 'buzzards', 'camels', 'canada geese', 'canids', 'cape buffalos', 'capybaras',
'cardinals', 'caribous', 'carps', 'cats', 'catsharks', 'caterpillars', 'catfishes', 'cattles',
'centipedes', 'cephalopods', 'chameleons', 'cheetahes', 'chickadees', 'chickens', 'chimpanzees', 'chinchillas',
'chipmunks', 'coatis', 'cicadas', 'clams', 'clownfishes', 'cobras', 'cockroaches', 'cods',
'condors', 'constrictors', 'corals', 'cougars', 'cows', 'coyotes', 'coypus', 'crabs',
'cranes', 'crane flys', 'crawdads', 'crayfishes', 'crickets', 'crocodiles', 'crows', 'cuckoos',
'damselflys', 'deers', 'dholes', 'dingos', 'dinosaurs', 'dodos', 'dogs', 'dolphins',
'donkeys', 'dormice', 'doves', 'dragonflys', 'dragons', 'ducks', 'dung beetles', 'eagles',
'earthworms', 'earwigs', 'echidnas', 'eels', 'egrets', 'elephants', 'elephant seals', 'elks',
'emus', 'english pointers', 'ermines', 'falcons', 'ferrets', 'fennecs', 'finches', 'fireflys',
'fishes', 'flamingos', 'fleas', 'flys', 'flyingfishes', 'fowls', 'foxes', 'frogs',
'fruit bats', 'flying squirrels', 'gamefowls', 'galliforms', 'gazelles', 'geckos', 'gerbils', 'giant pandas',
'giant squids', 'gibbons', 'gila monsters', 'giraffes', 'goats', 'golden eagles', 'goldfishes', 'geese',
'gophers', 'gorillas', 'grasshoppers', 'great blue herons', 'great white sharks', 'grebes', 'grizzly bears', 'ground sharks',
'ground sloths', 'grouses', 'guans', 'guanacos', 'guineafowls', 'guinea pigs', 'gulls', 'guppys',
'haddocks', 'halibuts', 'hammerhead sharks', 'hamsters', 'hares', 'harriers', 'hawks', 'hedgehogs',
'hermit crabs', 'herons', 'herrings', 'hippopotamuses', 'hookworms', 'hornets', 'horses', 'hoverflys',
'humans', 'hummingbirds', 'humpback whales', 'hyenas', 'hyraxes', 'iguanas', 'ibises', 'indian ring necks',
'jackals', 'jacanas', 'jaguars', 'jays', 'jellyfishes', 'judahes', 'jungle fowls', 'kangaroos',
'kangaroo mice', 'kangaroo rats', 'kingfishers', 'kites', 'kiwis', 'koalas', 'kois', 'komodo dragons',
'krills', 'ladybugs', 'lampreys', 'landfowls', 'land snails', 'lapwings', 'larks', 'leeches',
'lemmings', 'lemurs', 'leopards', 'leopons', 'limpets', 'lions', 'lionfishes', 'lizards',
'llamas', 'lobsters', 'locusts', 'loons', 'lorises', 'louses', 'lungfishes', 'lynxes',
'macaws', 'mackerels', 'magpies', 'mallards', 'mammals', 'manatees', 'mandrills', 'manta rays',
'marlins', 'marmosets', 'marmots', 'marsupials', 'martens', 'mastodons', 'mayas', 'meadowlarks',
'meerkats', 'megamouth sharks', 'minks', 'minnows', 'mites', 'mockingbirds', 'moles', 'mollusks',
'mongeese', 'monitor lizards', 'monkeys', 'mooses', 'mosquitos', 'mothes', 'mountain goats', 'mice',
'mules', 'muskoxes', 'narwhals', 'needlefishes', 'newts', 'new world quails', 'nighthawks', 'nightingales',
'nile crocodiles', 'numbats', 'ocelots', 'octopuses', 'okapis', 'old world quails', 'olingos', 'opossums',
'orangutans', 'orcas', 'oribis', 'ostriches', 'otters', 'owls', 'owl-faced monkeys', 'oxes',
'pandas', 'panthers', 'panthera hybrids', 'parakeets', 'parrots', 'parrotfishes', 'partridges', 'peacocks',
'peafowls', 'pelicans', 'penguins', 'perches', 'peregrine falcons', 'pheasants', 'pigs', 'pigeons',
'pikes', 'pilot whales', 'pinnipeds', 'piranhas', 'planarians', 'platypuses', 'polar bears', 'ponys',
'porcupines', 'porpoises', 'portuguese man o\' wars', 'possums', 'prairie dogs', 'prawns', 'praying mantises', 'primates',
'ptarmigans', 'puffins', 'pumas', 'pythons', 'quails', 'queleas', 'quetzals', 'quokkas',
'rabbits', 'raccoons', 'rainbow trouts', 'rats', 'rattlesnakes', 'ravens', 'rays', 'rays',
'red deers', 'red foxes', 'red pandas', 'red squirrels', 'reindeers', 'reptiles', 'rhinoceroses', 'right whales',
'roadrunners', 'rodents', 'rooks', 'roosters', 'roundworms', 'saber-toothed cats', 'sailfishes', 'salamanders',
'salmons', 'sawfishes', 'scale insects', 'scallops', 'scorpions', 'seahorses', 'sea lions', 'sea slugs',
'sea snails', 'servals', 'sharks', 'sheeps', 'shrews', 'shrimps', 'silkworms', 'silverfishes',
'skinks', 'skunks', 'sloths', 'slugs', 'smelts', 'snails', 'snakes', 'snipes',
'snow leopards', 'sockeye salmons', 'soles', 'sparrows', 'sperm whales', 'spiders', 'spider monkeys', 'spoonbills',
'squids', 'squirrels', 'starfishes', 'star-nosed moles', 'steelhead trouts', 'stingrays', 'stoats', 'storks',
'sturgeons', 'sugar gliders', 'swallows', 'swans', 'swifts', 'swordfishes', 'swordtails', 'tahrs',
'takins', 'tapirs', 'tarantulas', 'tarsiers', 'tasmanian devils', 'termites', 'terns', 'thrushes',
'ticks', 'tigers', 'tiger sharks', 'tiglons', 'titis', 'toads', 'tortoises', 'toucans',
'trapdoor spiders', 'tree frogs', 'trouts', 'tunas', 'turkeys', 'turtles', 'tyrannosauruses', 'urials',
'unicorns', 'vampire bats', 'vampire squids', 'vaquitas', 'vicuñas', 'vipers', 'vixens', 'voalavoanalas',
'voles', 'vultures', 'wallabys', 'walruses', 'wasps', 'warblers', 'waterbucks', 'water buffalos',
'water chevrotains', 'weasels', 'whales', 'whippets', 'whitefishes', 'white rhinoceroses', 'whooping cranes', 'wild boars',
'wildcats', 'wildebeests', 'wildfowls', 'wolves', 'wolverines', 'wombats', 'wood lemmings', 'woodchucks',
'woodpeckers', 'woolly dormice', 'woolly hares', 'worms', 'wrens', 'xerinaes', 'x-ray fishes', 'yaks',
'yellow perches', 'zebras', 'zebra finches', 'zebra sharks', 'zebus', 'zorillas', 'zanj sun squirrels', 'zaphir\'s shrews',
'zarudny\'s jirds', 'zarudny\'s rock shrews', 'zebra duikers', 'zempoaltepec deer mice', 'zempoaltépec voles', 'zenker\'s fruit bats', 'zuniga\'s dark rice rats',
];
function pickRandom(arr) {
return arr[Math.floor(Math.random() * arr.length)];
}
function maybePickRandom(arr) {
return Math.random() < 0.5 ? pickRandom(arr) : null;
}
function pickUpTo(arr, n) {
const out = [];
for (let i = 0; i < n; ++i) {
const word = maybePickRandom(arr);
if (word && !out.includes(word)) {
out.push(word);
}
}
if (out.length < 2) {
return out.join('');
} else {
return out.slice(0, -1).join(', ') + ' and ' + out.slice(-1)[0];
}
}
function capitalize(str) {
return str[0].toUpperCase() + str.slice(1);
}
const count = (typeof process !== 'undefined' && parseInt(process.argv[2], 10)) || 20;
const output = (new Array(count)).fill('').map(() => {
return [pickUpTo(adverbs, 2), pickRandom(verbs), pickUpTo(adjectives, 3), pickRandom(animals)].filter(Boolean).join(' ');
}).map(capitalize).sort().join('\n');
console.log(output);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment