Skip to content

Instantly share code, notes, and snippets.

@Rosa-Fox
Rosa-Fox / gist:9049568
Created February 17, 2014 12:17
Splitting string
class Tweet
def tweets(string)
@tweet = string
end
def tweetsplit
@tweet.split('/w')
end
@Rosa-Fox
Rosa-Fox / gist:9001829
Created February 14, 2014 14:25
Aims to match words from the last 10 tweets to words in the CSV and print
#Gets the last 10 tweets from a given user from the twitter API
screen_name = String.new ARGV[0]
#for each tweet
tweet = client.user_timeline(screen_name, count: 10).each do |tweet|
#Look through each row in the CSV file to see if any words in the tweet match the words in the 2nd element of the csv array(the word)
csv = CSV.foreach("csvratings.csv", {:headers=>true}).each do |row|
#For each line if the word matches words in the tweet then create a new array and put the valence mean value (3rd array element) in it.
@Rosa-Fox
Rosa-Fox / gist:8958628
Created February 12, 2014 16:11
Only prints one tweet
screen_name = String.new ARGV[0]
user = client.user(screen_name)
tweet = client.user_timeline(screen_name).first
count = client.user(count)
puts tweet.text
@Rosa-Fox
Rosa-Fox / gist:8860928
Created February 7, 2014 11:16
gemfile
source 'https://rubygems.org' gem 'rack'