Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
require 'csv'
require 'time'
drunk_tweets = []'tweets.csv'), headers: true, header_converters: :symbol) do |row|
tweet_hour = Time.parse(row[:timestamp]).hour
drunk_tweets << row if tweet_hour > 22 || tweet_hour < 5
drunk_tweets.reverse.each {|t| puts "#{Time.parse(t[:timestamp])}: #{t[:text]} ({t[:tweet_id]})\n---\n"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment