Skip to content

Instantly share code, notes, and snippets.

@mattb
Created July 24, 2008 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattb/2214 to your computer and use it in GitHub Desktop.
Save mattb/2214 to your computer and use it in GitHub Desktop.
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