gist: 2214 Download_button fork
public
Public Clone URL: git://gist.github.com/2214.git
Text only
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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

Owner

mattb

Revisions