Skip to content

Instantly share code, notes, and snippets.

@murphybytes
Created March 29, 2012 22:13
Show Gist options
  • Save murphybytes/2244277 to your computer and use it in GitHub Desktop.
Save murphybytes/2244277 to your computer and use it in GitHub Desktop.
Rich and John made a magic 8 ball using Vert.x ... and yeah could have used sample and the array but no-worky
require('vertx')
include Vertx
@server = HttpServer.new
@server.request_handler do | req |
premonition = [
'Yes.',
'Yes, definitely.',
'As I see it yes.',
'It is certain.',
'Without a doubt.',
'It is decidedly so.',
'You may rely on it.',
'Outlook good.',
'Most likely',
'Signs point to yes.',
'My reply is no.',
'My sources say no.',
'Very doubtful.',
'Outlook not so good.',
'Dont count on it.',
'Cannot predict now',
'Ask again later.',
'Better not tell you now.',
'Cannot predict now.',
'Reply hazy. Try again.',
'Concentrate and ask again.'
]
req.response.end( premonition[ (rand * premonition.size).to_i ] )
end.listen( 8080, 'localhost' )
@rdammkoehler
Copy link

Check my fork out git://gist.github.com/2244283.git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment