initial commit
This commit is contained in:
		
							parent
							
								
									713b1c2100
								
							
						
					
					
						commit
						0790e1e6f4
					
				
							
								
								
									
										60
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										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
 | 
					human-readable-ids-js
 | 
				
			||||||
=====================
 | 
					=====================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Use JavaScript to generate human-readable ids from a lists of nouns and adjectives.
 | 
					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
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										130
									
								
								adjectives.txt
									
									
									
									
									
										Normal file
									
								
							@ -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
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										102
									
								
								animals.txt
									
									
									
									
									
										Normal file
									
								
							@ -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
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								genids.js
									
									
									
									
									
										Normal file
									
								
							@ -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);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user