Skip to content

Instantly share code, notes, and snippets.

@russ
Created September 18, 2012 22:51
Show Gist options
  • Save russ/3746526 to your computer and use it in GitHub Desktop.
Save russ/3746526 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'tweetstream'
hash_tag = '#vegastech'
useage = []
def show_stats(stats)
# Aggregate Results
puts stats.inspect
end
TweetStream.configure do |config|
config.consumer_key = ENV['TWITTER_CONSUMER_KEY']
config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET']
config.oauth_token = ENV['TWITTER_OAUTH_TOKEN']
config.oauth_token_secret = ENV['TWITTER_OAUTH_TOKEN_SECRET']
config.auth_method = :oauth
end
TweetStream::Client.new.on_error do |message|
puts "Error from stream #{message}"
end.track(hash_tag) do |tweet|
useage << tweet.created_at.inspect
show_stats(useage) if useage.size % 100 == 0
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment