Skip to content

Instantly share code, notes, and snippets.

@hitode909
Created September 9, 2009 15:41
Show Gist options
  • Save hitode909/183830 to your computer and use it in GitHub Desktop.
Save hitode909/183830 to your computer and use it in GitHub Desktop.
require 'sinatra'
# tiny counter bot
$count = 0
get '/' do
$count+=1
puts $count
$count.to_s
end
require 'sinatra'
require 'timeout'
require 'readline'
$limit = ARGV.first.to_i || 2
get '/' do
input
end
def input
timeout($limit) do
p [Time.now, Time.now + $limit]
Readline.readline("> ", true)
end
rescue Timeout::Error
puts "timeout"
''
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment