Skip to content

Instantly share code, notes, and snippets.

@Rosa-Fox
Rosa-Fox / gist:8860928
Created February 7, 2014 11:16
gemfile
source 'https://rubygems.org' gem 'rack'
@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: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: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:9049599
Created February 17, 2014 12:20
Simplified
tweet = "Thisis a tweet"
tweetsplit = tweet.split('\w')
puts tweetsplit
@Rosa-Fox
Rosa-Fox / gist:9049608
Created February 17, 2014 12:21
Simplified
tweet = "This is, a tweet"
tweetsplit = tweet.split('\w')
puts tweetsplit
@Rosa-Fox
Rosa-Fox / gist:9052932
Created February 17, 2014 15:43
syntax error
#! /usr/bin/env ruby
require 'csv'
tweet = "Chocolate makes me happy, it makes my life wonderful"
tweetsplit = tweet.downcase.split(/\W+/)
valences = []
for tweetsplit do |i|
@Rosa-Fox
Rosa-Fox / gist:9053056
Created February 17, 2014 15:50
tweetsplit
#! /usr/bin/env ruby
require 'csv'
tweet = "Chocolate makes me happy, it makes my life wonderful"
tweetsplit = tweet.downcase.split(/\W+/)
valences! = []
for tweetsplit do |i|
@Rosa-Fox
Rosa-Fox / gist:9070231
Created February 18, 2014 12:44
Finds average
#! /usr/bin/env ruby
require 'csv'
tweet = "Chocolate makes me happy, it makes my life wonderful"
tweetsplit = tweet.downcase.split(/\W+/)
valences = []
tweetsplit.each do |i|
%nav.navbar.navbar-default
.container-fluid
.navbar-header
%span.navbar-brand
=link_to 'Users', admin_users_path
|
=link_to 'Invitations', admin_invitations_path
.collapse.navbar-collapse
.navbar-right
= link_to 'Log out', admin_session_path, method: 'delete', class: 'btn btn-sm btn-default navbar-btn'