Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- path: require 'path'
- Package: require('node-asset').Package
- router: new (require 'biggie-router')()
- io: require 'socket.io'
- TwitterNode: require('twitter-node').TwitterNode
- js_package: new Package 'assets/js/all.js', [
- 'socketio/socket.io.js'
- 'assets/js/raphael.js'
- 'assets/js/map.js'
- 'assets/coffee'
- ], {
- type: 'coffee'
- wrap: yes
- watch: yes
- compile: no
- compress: no
- }
- css_package: new Package 'assets/css/all.css', [
- 'assets/css/common.css'
- 'assets/css/screen.css'
- ], {
- type: 'css'
- watch: yes
- compile: yes
- compress: no
- }
- js_package.serve()
- css_package.serve()
- index_buffer: require('fs').readFileSync 'index.html'
- router.get(/^\/(|index.html)$/).module('gzip').bind (request, response) ->
- response.sendBody index_buffer
- router.get(/\.(js|css|html)/).module 'gzip'
- router.get(/^\/assets\/.*$/).module('static', __dirname).bind (request, response) ->
- response.sendBody 404, 'Not Found.'
- router.listen 8080
- socket: io.listen router
- twitter: new TwitterNode {
- user: 'user'
- password: 'password'
- action: 'sample'
- }
- previous_tweets: []
- twitter.addListener 'tweet', (tweet) ->
- if tweet.geo?.coordinates
- while previous_tweets.length > 50
- previous_tweets.shift()
- previous_tweets.push tweet
- socket.broadcast {
- text: tweet.text
- geo: tweet.geo.coordinates
- }
- twitter.stream()
- socket.addListener 'clientConnect', (client) ->
- for tweet in previous_tweets
- client.send tweet
Add Comment
Please, Sign In to add comment