Skip to content

Instantly share code, notes, and snippets.

@jshawl
Created December 4, 2014 21:28
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 jshawl/750cc8f40e70095b115b to your computer and use it in GitHub Desktop.
Save jshawl/750cc8f40e70095b115b to your computer and use it in GitHub Desktop.
require 'sinatra'
require 'sinatra/reloader'
get '/coin_toss' do
return ['Heads','Tails'].sample
end
get '/dice_roll' do
rand(1..6).to_s
end
get '/magic8ball/:question' do
answers = [
"It is certain",
"It is decidedly so",
"Without a doubt",
"Yes definitely",
"You may rely on it",
"As I see it yes",
"Most likely",
"Outlook good",
"Yes", "Signs point to yes",
"Reply hazy try again",
"Ask again later",
"Better not tell you now",
"Cannot predict now",
"Concentrate and ask again",
"Don't count on it",
"My reply is no",
"My sources say no",
"Outlook not so good",
"Very doubtful"
]
return params[:question] + "? <br>" + answers.sample
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment