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 'rubygems' | |
require 'google_drive' | |
###################################################################### | |
# Receive some input (not done or next) and update the task object -- this should be in /lib on its own | |
###################################################################### | |
class Task | |
attr_accessor :description, :created_at, :created_by, :status, :completed_at | |
def initialize(description) |
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 "docopt" | |
################################################## | |
# Task object | |
################################################## | |
class Task | |
attr_accessor :description, :creation_time, :completion_time, :completed | |
def initialize(description) |
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 'rubygems' | |
require 'google_drive' | |
# Go get your consumer key, client_secret, and client_id for Google Drive here https://code.google.com/apis/console/ | |
consumer_key = 'INSERT YOUR CONSUMER_KEY HERE' | |
client_secret = 'INSERT YOUR CLIENT_SECRET HERE' | |
client_id = 'INSERT YOUR CLIENT_ID HERE' | |
client = OAuth2::Client.new( | |
client_id, client_secret, |
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 'sunlight' | |
require 'csv' | |
class EventReporter | |
def run | |
command = "" | |
while command != "quit" | |
puts "" | |
printf "enter command: " | |
input = gets.chomp |
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
# Dependencies | |
require "csv" | |
require "sunlight" | |
# Class Definition | |
class EventManager | |
INVALID_ZIPCODE = "00000" | |
Sunlight::Base.api_key = "e179a6973728c4dd3fb1204283aaccb5" |
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
# Dependencies | |
require "csv" | |
# Class Definition | |
class EventManager | |
attr_reader :file | |
INVALID_ZIPCODE = "00000" | |
def initialize | |
puts "EventManager Initialized." |
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 'rspec' | |
class BaseballTeam | |
def initialize | |
@starters = { 1 => { 'Aviles' => 'SS' }, 2 => { 'Pedroia' => '2B' }, 3 => { 'Youkilis' => '1B' }, | |
4 => { 'Ortiz' => 'DH' }, 5 => { 'Middlebrooks' => '3B' }, 6 => { 'Gonzalez' => 'OF' }, | |
7 => { 'Saltalamacchia' => 'C' }, 8 => { 'McDonald' => 'OF' }, 9 => { 'Byrd' => 'OF' }, | |
0 => { 'Lester' => 'P' } } | |
end |
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
# Create a Red Sox class that represents the starting line-up of the Red Sox in a recent game. The line-up at the start of the game, 1 through 9, is given below with the pitcher indicated at 0 as he doesn't bat (sorry, NL fans): | |
# | |
# * 1, Aviles, SS | |
# * 2, Pedroia, 2B | |
# * 3, Youkilis, 1B | |
# * 4, Ortiz, DH | |
# * 5, Middlebrooks, 3B | |
# * 6, Gonzalez, OF | |
# * 7, Saltalamacchia, C | |
# * 8, McDonald, OF |
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 'rubygems' | |
require 'oauth' | |
require 'twitter' | |
consumer_key = 'HIDDEN' | |
consumer_secret = 'HIDDEN' | |
@consumer = OAuth::Consumer.new( | |
consumer_key, | |
consumer_secret, |
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
class Array | |
def new_count | |
count = 0 | |
(1..self.length).each do |i| | |
count += 1 if yield(self[i-1]) | |
end | |
count | |
end | |
end |