Created
May 23, 2014 13:30
-
-
Save darrinholst/3a46a509c3f112e0ddd3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 'csv' | |
require 'time' | |
drunk_tweets = [] | |
CSV.new(File.new('tweets.csv'), headers: true, header_converters: :symbol).to_a.map(&:to_hash).each do |row| | |
tweet_hour = Time.parse(row[:timestamp]).hour | |
drunk_tweets << row if tweet_hour > 22 || tweet_hour < 5 | |
end | |
drunk_tweets.reverse.each {|t| puts "#{Time.parse(t[:timestamp])}: #{t[:text]} (https://twitter.com/darrinholst/status/#{t[:tweet_id]})\n---\n"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment