Skip to content

Instantly share code, notes, and snippets.

@Phineas
Created January 16, 2017 21:28
Show Gist options
  • Save Phineas/3b183031d22990bb2d29e382f66d9f1d to your computer and use it in GitHub Desktop.
Save Phineas/3b183031d22990bb2d29e382f66d9f1d to your computer and use it in GitHub Desktop.
My Smashing Widgets
require 'twitter'
#### Get your twitter keys & secrets:
#### https://dev.twitter.com/docs/auth/tokens-devtwittercom
twitter = Twitter::REST::Client.new do |config|
config.consumer_key = 'YOUR_CONSUMER_KEY'
config.consumer_secret = 'YOUR_CONSUMER_SECRET'
config.oauth_token = 'YOUR_OAUTH_TOKEN'
config.oauth_token_secret = 'YOUR_OAUTH_SECRET'
end
SCHEDULER.every '10m', :first_in => 0 do |job|
user = twitter.user('itsphin')
begin
tweets = user.tweets_count
followers = user.followers_count
send_event('twitter_user_followers', current: followers)
send_event('twitter_user_tweets', current: tweets)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment