Skip to content

Instantly share code, notes, and snippets.

@jashkenas
Created May 6, 2011 20:18
Show Gist options
  • Select an option

  • Save jashkenas/959708 to your computer and use it in GitHub Desktop.

Select an option

Save jashkenas/959708 to your computer and use it in GitHub Desktop.
# /server.coffee
...
{TwitterNode} = require 'twitter-node'
# create our interface to the Twitter Streaming API
twitter = new TwitterNode
user: 'yourtwitterusername'
password: 'yourtwitterpassword'
track: ["why"]
# tell our interface what to do when a tweet comes in
twitter.addListener 'tweet', (tweet) ->
# print it.
console.log tweet.text
# start it up.
twitter.stream()
# /server.coffee
...
TwitterNode = require('twitter-node').TwitterNode
# create our interface to the Twitter Streaming API
twitter = new TwitterNode({
user: 'yourtwitterusername',
password: 'yourtwitterpassword',
track: ["why"]
})
# tell our interface what to do when a tweet comes in
twitter.addListener('tweet', (tweet) ->
# print it.
console.log(tweet.text)
)
# start it up.
twitter.stream()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment