Skip to content

Instantly share code, notes, and snippets.

@mattb mattb/gist:2214
Created Jul 24, 2008

Embed
What would you like to do?
require 'rubygems'
require 'fireeagle'
require 'twitter'
# get yourself an access token by hand on the irb commandline with the oauth gem
fe = FireEagle::Client.new(:consumer_key => "<yourkey>", :consumer_secret => "<yoursecret>", :access_token => "<youraccesstoken>", :access_token_secret => "<youraccesstokensecret>")
t=Twitter::Base.new "<yournick>","<yourpassword>"
lat = nil
lng = nil
while true
puts "Checking twitter"
if t.user('mattb').location.match(/([\-0-9.]+),([\-0-9.]+)/)
newlat = $1
newlng = $2
if newlat != lat or newlng != lng
lat = newlat
lng = newlng
rsp = fe.update(:lat => $1, :lon => $2)
if rsp.success?
puts "Successful update to #{lat}, #{lng}."
# specially for rabble, overwrite the "iPhone: lat,lng" with Fire Eagle's human-readable best guess.
t.update_location(fe.user.best_guess.to_s)
end
end
end
sleep 60*5
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.