Skip to content

Instantly share code, notes, and snippets.

@georgeredinger
Created August 15, 2010 07:45
Show Gist options
  • Save georgeredinger/525225 to your computer and use it in GitHub Desktop.
Save georgeredinger/525225 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'cgi'
cgi=CGI.new
print "Content-type: text/html\r\n\r\n"
puts "<h3>Usage: http://thewinneris.georgeredinger.com/names.rbi?name,name,name...,name</h1><br>"
candidates_list = cgi.params.to_s.split(",")
winner=candidates_list[rand(candidates_list.size)]
puts "<h1>The Winner is: #{winner}</h1>"
puts "Chosen at random from <br>"
puts "<ol>"
candidates_list.each {|c| puts "<li> #{c} </li>"}
puts "</ol>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment