Created
June 3, 2011 17:16
-
-
Save clintecker/1006712 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
require 'twitter' | |
require 'erb' | |
def get_file_as_string(filename) | |
data = '' | |
f = File.open(filename, "r") | |
f.each_line { |line| data += line } | |
data | |
end | |
group_order = [:main, :sections, :writing_staff, :tech_staff, :contributors, :emeritus] | |
accounts = { | |
:main => [:arstechnica], | |
:sections => [:arsinfiniteloop, :onemicrosoftway, :nobelintent], | |
:writing_staff => [:kenfisher, :hannibalrex, :ericbangeman, :natexanderson, :ejacqui, :benkuchera, :segphault, :j_timmer, :aranciata], | |
:tech_staff => [:clint, :leed0, :aurich], | |
:emeritus => [:mrkurt,], | |
:contributors => [:foresmac, :caseyjohnston, :drpizza, :a_webster, :matthewlasar, :yun_xie, :glennf, :binarybits, :dmgitig, :siracusa, :drjonboyg, :continuum], | |
} | |
additional_info = { | |
:aranciata => 'Copy Editor', | |
:siracusa => 'Apple Technology Specialist', | |
:binarybits => 'Tech Policy Contributor', | |
:continuum => 'System Guide Ninja', | |
:yun_xie => 'Science Contributor', | |
:dmgitig => 'Science Contributor', | |
:leed0 => 'Programmer' | |
} | |
Twitter.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_SECRET'] | |
end | |
# Get a flat list of names to query for | |
screen_names = accounts.keys.map{ |g| accounts[g].map{ |a| a.to_s }}.flatten | |
twitter_data = Twitter::Client.new.users(*screen_names) | |
organized_data = Hash[twitter_data.map{ |t| [t.screen_name.downcase.to_sym, t] }] | |
template = get_file_as_string('twatz.erb') | |
html = ERB.new(template, 0, "%<>") | |
output = html.result | |
puts output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment