Created
September 21, 2014 03:13
-
-
Save kei-s/c8a5cc3d662b09979972 to your computer and use it in GitHub Desktop.
RubyHiroba blink1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source "https://rubygems.org" | |
gem "rb-blink1" | |
gem "twitter" | |
gem "dotenv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/setup' | |
require 'blink1' | |
require 'twitter' | |
require 'dotenv' | |
Dotenv.load | |
client = Twitter::Streaming::Client.new do |config| | |
config.consumer_key = ENV['twitter_consumer_key'] | |
config.consumer_secret = ENV['twitter_consumer_secret'] | |
config.access_token = ENV['twitter_access_token'] | |
config.access_token_secret = ENV['twitter_access_token_secret'] | |
end | |
colors = (127..255).to_a | |
client.filter(track: 'rubyhiroba') do |tweet| | |
puts "@#{tweet.user.screen_name}: #{tweet.text}" | |
Blink1.open do |blink1| | |
blink1.set_rgb(colors.sample, colors.sample, colors.sample) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment