Browse Source

initial commit

master
AJ ONeal 10 years ago
parent
commit
0790e1e6f4
  1. 60
      README.md
  2. 130
      adjectives.txt
  3. 102
      animals.txt
  4. 31
      genids.js
  5. 7
      tpl.js

60
README.md

@ -1,4 +1,64 @@
NOT YET PUSHED
====
I got tired last night and didn't finish the npm publish script.
Will do in the morning...
human-readable-ids-js
=====================
Use JavaScript to generate human-readable ids from a lists of nouns and adjectives.
Generate ids in the format of `adjective-noun-#` such as
* silly-goose-37
* quick-cobra-15
* tricky-chicken-23
* brave-ladybug-90
My problem is that I often want ids that I can type without having to
look at it twice (nor telling someone else twice).
I should be able to shout one of these ids across the room to a co-worker
or spouse and have them be able to enter it in without any confusion.
Currently the id space is aboutt 100 * 100 * 100.
The goal is to have several billion possible combinations.
Install
=======
```
npm install --save human-readable-ids
```
```
bower install --save human-readable-ids
```
Contributing
============
Please add more words that fit these criteria
* Easy-to-spell - such that even my redneck dad can manage
* Phonetically distinct - no words like bore/boar
* Few syllables
* Well-known
All of the words are sorted alphabetically (`sort -u`) and stored in
the `*.txt` files.
The pre-publish script outputs the formatted javascript.
TODO
====
Acheive 1 trillion ids with a combination such as
`number adjective noun verb adverb`
And allow choosing various formats based on the desired
number of ids.
* `adjective noun number`
* `number adjective noun verb`

130
adjectives.txt

@ -0,0 +1,130 @@
afraid
ancient
angry
average
bad
big
bitter
black
blue
brave
breezy
bright
calm
chatty
chilly
clever
cold
cowardly
cuddly
curly
curvy
dangerous
dry
dull
empty
evil
fast
fat
fluffy
foolish
fresh
friendly
funny
fuzzy
gentle
giant
good
great
green
grumpy
happy
hard
heavy
helpless
honest
horrible
hot
hungry
itchy
jolly
kind
lazy
light
little
loud
lovely
lucky
massive
mean
mighty
modern
moody
nasty
neat
nervous
new
nice
odd
old
orange
ordinary
perfect
pink
plastic
polite
popular
pretty
proud
purple
quick
quiet
rare
red
rotten
rude
selfish
serious
shaggy
sharp
short
shy
silent
silly
slimy
slippery
smart
smooth
soft
sour
spicy
splendid
spotty
stale
strange
strong
stupid
sweet
swift
tall
tame
tasty
tender
terrible
thin
tidy
tiny
tough
tricky
ugly
unlucky
warm
weak
wet
white
wicked
wise
witty
wonderful
yellow
young

102
animals.txt

@ -0,0 +1,102 @@
ape
baboon
badger
bat
bear
bird
bobcat
bulldog
bullfrog
cat
catfish
cheetah
chicken
chipmunk
cobra
cougar
cow
crab
deer
dingo
dodo
dog
dolphin
donkey
dragon
dragonfly
duck
eagle
earwig
eel
elephant
emu
falcon
fireant
firefox
fish
fly
fox
frog
gecko
goat
goose
grasshopper
horse
hound
husky
impala
insect
jellyfish
kangaroo
ladybug
liger
lion
lionfish
lizard
mayfly
mole
monkey
moose
moth
mouse
mule
newt
octopus
otter
owl
panda
panther
parrot
penguin
pig
puma
pug
quail
rabbit
rat
rattlesnake
robin
seahorse
sheep
shrimp
skunk
sloth
snail
snake
squid
starfish
stingray
swan
termite
tiger
treefrog
turkey
turtle
vampirebat
walrus
warthog
wasp
wolverine
wombat
yak
zebra

31
genids.js

@ -0,0 +1,31 @@
'use strict';
var fs = require('fs')
, path = require('path')
, shuffle = require('knuth-shuffle').knuthShuffle
, animalsFile = path.join(__dirname, 'animals.txt')
, adjectivesFile = path.join(__dirname, 'adjectives.txt')
, animals
, adjectives
, numbers = []
, i = 0
, id
;
animals = fs.readFileSync(animalsFile, 'utf8').split('\n');
adjectives = fs.readFileSync(adjectivesFile, 'utf8').split('\n');
while (i <= 101) {
numbers.push(i);
i += 1;
}
for (i = 0; i < 1000; i += 1) {
i += 1;
id = shuffle(adjectives)[0]
+ '-' + shuffle(animals)[0]
+ '-' + shuffle(numbers)[0]
;
console.log(id);
}

7
tpl.js

@ -0,0 +1,7 @@
/*jshint -W054 */
;(function (exports) {
'use strict';
exports.humanReadableIds = exports.humanReadableIds || {};
exports.humanReadableIds.{{setname}} = {{set}};
}('undefined' !== typeof exports && exports || new Function('return this')()));
Loading…
Cancel
Save