Skip to content

Instantly share code, notes, and snippets.

@stnly
Created November 12, 2013 10:24
Show Gist options
  • Select an option

  • Save stnly/7428689 to your computer and use it in GitHub Desktop.

Select an option

Save stnly/7428689 to your computer and use it in GitHub Desktop.
switcher.
require 'sinatra'
get '/' do
num = Math.random
if num > 0 && num < 0.25
name = `python -e "print "Stanley Tan"`
elsif num > 0.25 && num < 0.5
name = `node -e "console.log("Stanley Tan")"`
elsif num > 0.5 && num < 0.75
name = `ruby -e "puts "Stanley Tan""`
elsif num > 0.75 && num < 1
name = `echo Stanley Tan`
erb :index
end
<h1><%= name %></h1>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment