Skip to content

Instantly share code, notes, and snippets.

@robustdj
Created November 8, 2010 07:10
Show Gist options
  • Save robustdj/667450 to your computer and use it in GitHub Desktop.
Save robustdj/667450 to your computer and use it in GitHub Desktop.
Boy Names
# using ruby 1.8.7
if ARGV.empty?
puts "USAGE: ruby boy_name.rb <letter>"
exit
end
file = File.open("boy_names.txt")
names = file.lines.to_a.group_by{|name| name[0,1]}
selected_names = names[ARGV[0].capitalize]
puts selected_names[rand(selected_names.size)]
Aaron
Abdiel
Abdullah
Abel
Abraham
Abram
Adam
Adan
Addison
Aden
Aditya
Adolfo
Adonis
Adrian
Adriel
Adrien
Agustin
Ahmad
Ahmed
Aidan
Aiden
Alan
Albert
Alberto
Alden
Aldo
Alec
Alejandro
Alessandro
Alex
Deandre
Deangelo
Declan
Demarcus
Demetrius
Dennis
Denzel
Deon
Deonte
Derek
Derick
Derrick
Deshaun
Deshawn
Desmond
Destin
Devan
Devante
Deven
Devin
Devon
Devonte
Devyn
Dexter
Diego
Dillan
Dillon
Dimitri
Dion
Domenic
Jay
Jayce
Jayden
Jaydon
Jaylan
Jaylen
Jaylin
Jaylon
Jayson
Jean
Jeff
Jefferson
Jeffery
Jeffrey
Jeremiah
Jeremy
Jermaine
Jerome
Jerry
Jesse
Jessie
Jesus
Jett
Jevon
Jimmy
Joan
Joaquin
Joe
Joel
Joey
Nolan
Norman
Octavio
Oliver
Omar
Omari
Omarion
Orion
Orlando
Osbaldo
Oscar
Osvaldo
Oswaldo
Owen
Pablo
Parker
Patrick
Paul
Paxton
Payton
Pedro
Perry
Peter
Peyton
Philip
Phillip
Phoenix
Pierce
Pierre
Porter
Alexander
Alexandre
Alexandro
Alexis
Alexzander
Alfonso
Alfred
Alfredo
Ali
Alijah
Allan
Allen
Alonso
Alonzo
Alvaro
Alvin
Amari
Amarion
Amir
Anderson
Andre
Andres
Andrew
Andy
Angel
Angelo
Anthony
Antoine
Anton
Antonio
Antony
Antwan
Ari
Ariel
Arjun
Armando
Armani
Arnold
Aron
Arthur
Arturo
Aryan
Asa
Dominic
Dominick
Dominik
Dominique
Donald
Donavan
Donovan
Dontae
Donte
Dorian
Douglas
Drake
Draven
Drew
Duane
Duncan
Dustin
Dwayne
Dwight
Dylan
Dylon
Ean
Earl
Easton
Eddie
Eddy
Edgar
Edgardo
Eduardo
Edward
Edwin
Efrain
Efren
Eli
Elian
Elias
Eliezer
Elijah
Eliseo
Elisha
Elliot
Elliott
Ellis
Johan
John
Johnathan
Johnathon
Johnny
Jon
Jonah
Jonas
Jonatan
Jonathan
Jonathon
Jordan
Jorden
Jordon
Jordy
Jorge
Jose
Josef
Joseph
Josh
Joshua
Josiah
Josue
Jovan
Jovani
Jovany
Juan
Judah
Jude
Julian
Julien
Julio
Julius
Junior
Justice
Justin
Justus
Justyn
Kade
Kaden
Kadin
Kai
Kaiden
Pranav
Preston
Prince
Quentin
Quincy
Quinn
Quinten
Quintin
Quinton
Rafael
Rahul
Ralph
Ramiro
Ramon
Randall
Randy
Raphael
Rashad
Raul
Ray
Raymond
Raymundo
Reagan
Reece
Reed
Reese
Reginald
Reid
Reilly
Remington
Rene
Reuben
Rey
Reynaldo
Rhett
Ricardo
Richard
Rickey
Ricky
Rigoberto
Riley
River
Robert
Asher
Ashton
Aubrey
August
Augustus
Austen
Austin
Austyn
Avery
Axel
Ayden
Ben
Benjamin
Bennett
Benny
Bernard
Bernardo
Bilal
Billy
Blaine
Blaise
Blake
Blaze
Bo
Bobby
Brad
Braden
Bradley
Brady
Bradyn
Braeden
Braedon
Braiden
Branden
Brandon
Braulio
Braxton
Elmer
Elvin
Elvis
Emanuel
Emerson
Emiliano
Emilio
Emmanuel
Emmett
Enrique
Eric
Estevan
Ethan
Ethen
Eugene
Evan
Everett
Ezekiel
Ezequiel
Ezra
Fabian
Felipe
Felix
Fernando
Fidel
Finn
Forrest
Francis
Francisco
Frank
Frankie
Franklin
Fred
Freddie
Freddy
Frederick
Kale
Kaleb
Kameron
Kamron
Kane
Kareem
Karl
Karson
Kasey
Kayden
Keagan
Keanu
Keaton
Kelly
Kelton
Kelvin
Kendall
Kendrick
Kennedy
Kenneth
Kent
Kenyon
Keon
Keshawn
Keven
Kevin
Kevon
Keyon
Keyshawn
Khalid
Khalil
Kian
Kieran
Kirk
Kobe
Koby
Kody
Roberto
Rocco
Roderick
Rodney
Rodolfo
Rodrigo
Rogelio
Roger
Rohan
Roland
Romeo
Ronald
Ronaldo
Ronan
Rory
Ross
Rowan
Roy
Ruben
Rudy
Russell
Ryan
Ryder
Rylan
Ryley
Sabastian
Sage
Salvador
Salvatore
Sam
Samir
Sammy
Samuel
Santiago
Santino
Santos
Saul
Brayan
Brayden
Braydon
Brendan
Brenden
Brendon
Brennan
Brennen
Brent
Brenton
Bret
Brett
Brian
Brice
Brock
Brodie
Brody
Brooks
Bruce
Bruno
Bryan
Bryant
Bryce
Brycen
Bryson
Byron
Cade
Caden
Cael
Caiden
Cale
Caleb
Calvin
Camden
Cameron
Camren
Camron
Carl
Carlo
Carlos
Carlton
Carson
Carter
Casey
Cason
Cayden
Gabriel
Gael
Gage
Gaige
Gannon
Garett
Garret
Garrett
Garrison
Gary
Gaven
Gavin
Gavyn
Geoffrey
George
Gerald
Gerard
Gerardo
German
Gian
Giancarlo
Gianni
Gideon
Gilbert
Gilberto
Gino
Giovanni
Giovanny
Glen
Glenn
Gonzalo
Gordon
Grady
Graham
Grant
Grayson
Gregory
Greyson
Griffin
Guadalupe
Guillermo
Gunnar
Gunner
Gustavo
Guy
Haden
Kolby
Kole
Kolton
Korbin
Korey
Kory
Kristian
Kristofer
Kristopher
Kurt
Kurtis
Kylan
Kyle
Kyler
Kyree
Lamar
Lamont
Lance
Landen
Landon
Lane
Larry
Latrell
Lawrence
Lawson
Layne
Layton
Lee
Leo
Leon
Leonard
Leonardo
Leonel
Leroy
Levi
Lewis
Liam
Lincoln
Lisandro
Logan
London
Lonnie
Lorenzo
Louis
Luc
Luca
Savion
Sawyer
Scott
Seamus
Sean
Sebastian
Semaj
Sergio
Seth
Shamar
Shane
Shannon
Shaun
Shawn
Shayne
Shea
Sheldon
Shemar
Sidney
Silas
Simon
Sincere
Skylar
Skyler
Solomon
Sonny
Spencer
Stanley
Stefan
Stephan
Stephen
Stephon
Sterling
Steve
Steven
Stone
Stuart
Sullivan
Syed
Talon
Tanner
Tariq
Tate
Tavion
Taylor
Terrance
Cedric
Cesar
Chad
Chaim
Chance
Chandler
Charles
Charlie
Chase
Chaz
Chris
Christian
Christopher
Clarence
Clark
Clay
Clayton
Clifford
Clifton
Clinton
Coby
Cody
Colby
Cole
Coleman
Colin
Collin
Colt
Colten
Colton
Conner
Connor
Conor
Conrad
Cooper
Corbin
Cordell
Corey
Cornelius
Cortez
Cory
Craig
Cristian
Cristobal
Cristopher
Cruz
Cullen
Curtis
Cyrus
Dakota
Dale
Dallas
Dallin
Dalton
Damian
Damien
Damion
Damon
Dandre
Dane
Dangelo
Daniel
Danny
Dante
Daquan
Darian
Darien
Darin
Dario
Darion
Darius
Darnell
Darrell
Darren
Darrin
Darrion
Darrius
Darryl
Darwin
Daryl
Dashawn
David
Davin
Hamza
Harley
Harold
Harrison
Harry
Hassan
Hayden
Heath
Hector
Henry
Herbert
Heriberto
Holden
Houston
Howard
Hudson
Hugh
Hugo
Humberto
Hunter
Ian
Ibrahim
Ignacio
Immanuel
Irvin
Irving
Isaac
Isaak
Isai
Isaiah
Isaias
Isiah
Ismael
Israel
Issac
Ivan
Izaiah
Jabari
Jace
Jack
Jackson
Jacob
Jacoby
Jaden
Jadon
Jadyn
Jaeden
Jagger
Jaheem
Jaheim
Jahiem
Jaiden
Jaime
Jair
Jairo
Jake
Jakob
Jakobe
Jalen
Jamal
Jamar
Jamari
Jamel
James
Jameson
Jamie
Jamil
Jamir
Jamison
Jan
Jaquan
Jaquez
Jared
Jaren
Jarod
Jaron
Jarred
Jarrett
Jarrod
Jarvis
Jase
Jason
Jasper
Lucas
Luciano
Luis
Lukas
Luke
Malachi
Malakai
Malcolm
Malik
Manuel
Marc
Marcel
Marcelo
Marco
Marcos
Marcus
Mariano
Mario
Mark
Markus
Marlon
Marquez
Marquis
Marquise
Marshall
Martin
Marvin
Mason
Mateo
Mathew
Matteo
Matthew
Maurice
Mauricio
Maverick
Max
Maxim
Maximilian
Maximillian
Maximo
Maximus
Maxwell
Mekhi
Melvin
Micah
Michael
Micheal
Miguel
Mike
Mikel
Miles
Milo
Milton
Misael
Mitchel
Mitchell
Mohamed
Mohammad
Mohammed
Moises
Morgan
Moses
Moshe
Muhammad
Mustafa
Myles
Nash
Nasir
Nathan
Nathanael
Nathanial
Nathaniel
Nathen
Neal
Nehemiah
Neil
Nelson
Nestor
Nicholas
Nick
Nickolas
Nico
Nicolas
Terrell
Terrence
Terry
Thaddeus
Theodore
Thomas
Timothy
Titus
Tobias
Toby
Todd
Tomas
Tommy
Tony
Trace
Travis
Travon
Tre
Trent
Trenton
Trever
Trevin
Trevion
Trevon
Trevor
Trey
Treyton
Tristan
Tristen
Tristian
Tristin
Triston
Troy
Trystan
Tucker
Turner
Ty
Tyler
Tylor
Tyree
Tyrell
Tyrese
Tyrone
Tyshawn
Tyson
Ulises
Ulysses
Uriel
Vance
Vaughn
Vernon
Vicente
Victor
Vincent
Wade
Walker
Walter
Warren
Waylon
Wayne
Wesley
Weston
Will
William
Willie
Wilson
Winston
Wyatt
Xander
Xavier
Xzavier
Yadiel
Yahir
Yosef
Zachariah
Zachary
Zachery
Zack
Zackary
Zackery
Zain
Zaire
Zakary
%w{apple banana cucumber}.group_by{|fruit| fruit[0,1]}
=> #<OrderedHash {"a"=>["apple"], "b"=>["banana"], "c"=>["cucumber"]}>
names = file.lines.to_a.group_by{|name| name[0,1]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment