Skip to content

Instantly share code, notes, and snippets.

@hackervera
Created September 22, 2010 01:56
Show Gist options
  • Select an option

  • Save hackervera/590986 to your computer and use it in GitHub Desktop.

Select an option

Save hackervera/590986 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'httparty'
def async(arg,callback)
Thread.new {
sleep 10
resp = HTTParty.get(arg)
callback.call(resp)
}
end
host = "http://www.google.com"
thr = async(host,lambda { |resp| puts resp })
puts "getting #{host}"
thr.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment