Skip to content

Instantly share code, notes, and snippets.

@donpdonp
Created July 28, 2010 00:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save donpdonp/493101 to your computer and use it in GitHub Desktop.
Save donpdonp/493101 to your computer and use it in GitHub Desktop.
require 'json'
require 'isaac'
configure do |c|
c.nick = "icecondor"
c.server = "irc.freenode.net"
c.port = 6667
end
on :connect do
join "#geoloqi"
end
on :channel, /^icecondor: where is (.*)/ do
msg channel, "#{nick}: I dont know where '#{match[0]}' is. "
end
on :channel, /^icecondor: foursquare (.*) (.*)/ do |lat,long|
msg channel, "#{nick}: closest venue: #{closest_foursquare(lat,long)}"
end
on :channel, /^icecondor: (.*)/ do
msg channel, "Quote: '#{match[0]}' by #{nick}"
end
def closest_foursquare(lat,long)
j= JSON.parse(`curl -u user:pass 'http://api.foursquare.com/v1/venues.json?geolat=#{lat}&geolong=#{long}'`)
j["error"] || j["groups"].first["venues"].first["name"]
end
@hackervera
Copy link

Nice!

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