Created
August 3, 2010 06:37
-
-
Save ecito/505950 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var boxes = [-90, -60, -80, -50, -80, -60, -70, -50, -70, -60, -60, -50, -60, -60, -50, -50, -50, -60, -40, -50, -40, -60, -30, -50, -30, -60, -20, -50, -90, -50, -80, -40, -80, -50, -70, -40, -70, -50, -60, -40, -60, -50, -50, -40, -50, -50, -40, -40, -40, -50, -30, -40, -30, -50, -20, -40, -90, -40, -80, -30, -80, -40, -70, -30, -70, -40, -60, -30, -60, -40, -50, -30, -50, -40, -40, -30, -40, -40, -30, -30, -30, -40, -20, -30, -90, -30, -80, -20, -80, -30, -70, -20, -70, -30, -60, -20, -60, -30, -50, -20, -50, -30, -40, -20, -40, -30, -30, -20, -30, -30, -20, -20, -90, -20, -80, -10, -80, -20, -70, -10, -70, -20, -60, -10, -60, -20, -50, -10, -50, -20, -40, -10, -40, -20, -30, -10, -30, -20, -20, -10, -90, -10, -80, 0, -80, -10, -70, 0, -70, -10, -60, 0, -60, -10, -50, 0, -50, -10, -40, 0, -40, -10, -30, 0, -30, -10, -20, 0, -90, 0, -80, 10, -80, 0, -70, 10, -70, 0, -60, 10, -60, 0, -50, 10, -50, 0, -40, 10, -40, 0, -30, 10, -30, 0, -20, 10, -90, 10, -80, 20, -80, 10, -70, 20, -70, 10, -60, 20, -60, 10, -50, 20, -50, 10, -40, 20, -40, 10, -30, 20, -30, 10, -20, 20, -20, -20, -10, -10, -10, -20, 0, -10, 0, -20, 10, -10, 10, -20, 20, -10, 20, -20, 30, -10, 30, -20, 40, -10, 40, -20, 50, -10, -20, -10, -10, 0, -10, -10, 0, 0, 0, -10, 10, 0, 10, -10, 20, 0, 20, -10, 30, 0, 30, -10, 40, 0, 40, -10, 50, 0, -20, 0, -10, 10, -10, 0, 0, 10, 0, 0, 10, 10, 10, 0, 20, 10, 20, 0, 30, 10, 30, 0, 40, 10, 40, 0, 50, 10, -20, 10, -10, 20, -10, 10, 0, 20, 0, 10, 10, 20, 10, 10, 20, 20, 20, 10, 30, 20, 30, 10, 40, 20, 40, 10, 50, 20, -20, 20, -10, 30, -10, 20, 0, 30, 0, 20, 10, 30, 10, 20, 20, 30, 20, 20, 30, 30, 30, 20, 40, 30, 40, 20, 50, 30, -20, 30, -10, 40, -10, 30, 0, 40, 0, 30, 10, 40, 10, 30, 20, 40, 20, 30, 30, 40, 30, 30, 40, 40, 40, 30, 50, 40, -20, 40, -10, 50, -10, 40, 0, 50, 0, 40, 10, 50, 10, 40, 20, 50, 20, 40, 30, 50, 30, 40, 40, 50, 40, 40, 50, 50, -10, 40, 0, 50, 0, 40, 10, 50, 10, 40, 20, 50, 20, 40, 30, 50, 30, 40, 40, 50, 40, 40, 50, 50, 50, 40, 60, 50, -10, 50, 0, 60, 0, 50, 10, 60, 10, 50, 20, 60, 20, 50, 30, 60, 30, 50, 40, 60, 40, 50, 50, 60, 50, 50, 60, 60, -10, 60, 0, 70, 0, 60, 10, 70, 10, 60, 20, 70, 20, 60, 30, 70, 30, 60, 40, 70, 40, 60, 50, 70, 50, 60, 60, 70, -10, 70, 0, 80, 0, 70, 10, 80, 10, 70, 20, 80, 20, 70, 30, 80, 30, 70, 40, 80, 40, 70, 50, 80, 50, 70, 60, 80, -140, 10, -130, 20, -130, 10, -120, 20, -120, 10, -110, 20, -110, 10, -100, 20, -100, 10, -90, 20, -90, 10, -80, 20, -80, 10, -70, 20, -70, 10, -60, 20, -60, 10, -50, 20, -140, 20, -130, 30, -130, 20, -120, 30, -120, 20, -110, 30, -110, 20, -100, 30, -100, 20, -90, 30, -90, 20, -80, 30, -80, 20, -70, 30, -70, 20, -60, 30, -60, 20, -50, 30, -140, 30, -130, 40, -130, 30, -120, 40, -120, 30, -110, 40, -110, 30, -100, 40, -100, 30, -90, 40, -90, 30, -80, 40, -80, 30, -70, 40, -70, 30, -60, 40, -60, 30, -50, 40, -140, 40, -130, 50, -130, 40, -120, 50, -120, 40, -110, 50, -110, 40, -100, 50, -100, 40, -90, 50, -90, 40, -80, 50, -80, 40, -70, 50, -70, 40, -60, 50, -60, 40, -50, 50]//, -140, 50, -130, 60, -130, 50, -120, 60, -120, 50, -110, 60, -110, 50, -100, 60, -100, 50, -90, 60, -90, 50, -80, 60, -80, 50, -70, 60, -70, 50, -60, 60, -60, 50, -50, 60, -140, 60, -130, 70, -130, 60, -120, 70, -120, 60, -110, 70, -110, 60, -100, 70, -100, 60, -90, 70, -90, 60, -80, 70, -80, 60, -70, 70, -70, 60, -60, 70, -60, 60, -50, 70, -140, 70, -130, 80, -130, 70, -120, 80, -120, 70, -110, 80, -110, 70, -100, 80, -100, 70, -90, 80]//, -90, 70, -80, 80, -80, 70, -70, 80, -70, 70, -60, 80, -60, 70, -50, 80] | |
var sys = require('sys'); | |
var TwitterNode = require('./twitter-node').TwitterNode; | |
var twit = new TwitterNode({ | |
user: '<twitter_user>', | |
password: '<twitter_password>', | |
//track: ["inception"], | |
locations: boxes | |
}); | |
twit.headers['User-Agent'] = 'node.js-thingy'; | |
twit.addListener('error', function(error) { | |
sys.puts(error.message); | |
}); | |
sys.puts("Start the twittah party"); | |
twit.addListener('tweet', function(tweet) { | |
sys.puts("@" + tweet.user.screen_name + ": " + tweet.text); | |
}); | |
var net = require("net"); | |
net.createServer(function(socket){ | |
twit.addListener('tweet', function(tweet) { | |
try { | |
socket.write(JSON.stringify(tweet)); | |
} | |
catch (e) { | |
// socket.close(); // ??? | |
// socket.destroy(); // ??? | |
// socket.end(); // ??? | |
sys.puts("Socket write error"); | |
} | |
}) | |
//socket.setTimeout(100); | |
socket.on("end", function () { | |
socket.end(); | |
}); | |
}).listen(6969); | |
twit.stream(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment