Repository navigation
Expand file tree
/
Copy pathgriddle.js
More file actions
71 lines (58 loc) · 5.28 KB
/
Copy pathgriddle.js
File metadata and controls
71 lines (58 loc) · 5.28 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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'),
arrays = require('./vendor/arrays');
var TwitterNode = require('twitter-node').TwitterNode;
var twit = new TwitterNode({
user: 'fryingpancakes',
password: 'maplesyrup',
locations: [-77.26, 38.85, -76.83, 38.94]
});
twit.headers['User-Agent'] = 'node.js-thingy';
twit.addListener('error', function(error) {
sys.puts(error.message);
});
sys.puts("Start the twittah party");
twit.action = 'filter';
var clients = [];
var net = require("net");
net.createServer(function(socket){
clients.push(socket);
socket.addListener("connect", function (resource) {
// emitted after handshake
sys.debug("connect: " + resource);
}).addListener("close", function () {
// emitted when server or client closes connection
clients.remove(socket);
sys.debug("close");
});
socket.on("end", function () {
socket.end();
});
twit.addListener('tweet', function(tweet) {
if(tweet.geo)
sys.puts("@" + tweet.user.screen_name + ": " + tweet.text + "(" + tweet.geo.coordinates[0] + ", " + tweet.geo.coordinates[1] +")");
else
sys.puts("@" + tweet.user.screen_name + ": " + tweet.text);
socket.write(JSON.stringify(tweet));
// sys.puts(".")
});
// try {
// sys.puts("writing")
// socket.write(JSON.stringify(tweet));
// }
// catch (e) {
// // socket.close(); // ???
// // socket.destroy(); // ???
// // socket.end(); // ???
//
// sys.puts("Socket write error");
// }
// })
}).listen(6969);
//
// twit.addListener('tweet', function(tweet) {
// clients.each(function(c) {
// c.write(JSON.stringify(tweet));
// });
// });
twit.stream();