Created
March 29, 2012 22:13
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Check my fork out git://gist.github.com/2244283.git