Skip to content

Instantly share code, notes, and snippets.

View rosiehoyem's full-sized avatar

Rosie Hoyem rosiehoyem

View GitHub Profile
@rosiehoyem
rosiehoyem / jukebox.rb
Created October 7, 2013 18:01
Jukebox Debugger
require_relative './song_library.rb'
def jukebox(command)
if command.downcase == "list"
list_library
else
parse_command(command)
end
end
@rosiehoyem
rosiehoyem / regex_sample.rb
Created October 8, 2013 15:47
Code samples for RegEx, String Literals and other Funny Looking Things in Ruby
code
@rosiehoyem
rosiehoyem / school_class.rb
Created October 9, 2013 13:01
School domain model
class School
attr_accessor :roster, :name, :grade
def initialize(name)
@name = name
@roster = {}
end
def add_student(student_name, grade)
@roster[grade] ||= []
@rosiehoyem
rosiehoyem / jukebox_spec.rb
Created October 9, 2013 13:11
Jukebox Rspec Tests
require 'simplecov'
SimpleCov.start
require 'json'
require 'rspec'
require_relative 'jukebox'
require_relative 'song'
#use this song data for your tests
songs = [
@rosiehoyem
rosiehoyem / hashketball.rb
Created October 13, 2013 17:07
Hashketball homework
# Using Nested Hashes, define a game, with two teams, their players, and the players stats:
# The game has two teams.
# A team has:
# A name
# Two colors
# Each team should have at least 5 players
# Each player should have a:
# name
@rosiehoyem
rosiehoyem / triangle.rb
Created October 13, 2013 17:19
Triangle TODO, Day 13
class Triangle
attr_accessor :s1, :s2, :s3
def initialize(s1, s2, s3)
@s1 = s1
@s2 = s2
@s3 = s3
end
def kind
@rosiehoyem
rosiehoyem / jukebox_spec.rb
Created October 13, 2013 17:24
Jukebox Rspec code coverage lab
require 'simplecov'
SimpleCov.start
require 'json'
require 'rspec'
require_relative 'jukebox'
require_relative 'song'
#use this song data for your tests
songs = [
@rosiehoyem
rosiehoyem / jukebox_oo_refactored.rb
Created October 13, 2013 17:28
Object Oriented Jukebox, Day 12
songs = ["Miley Cyrus - We Can't Stop",
"Katy Perry - Roar",
"Robin Thicke - Blurred Lines",
"Daft Punk - Get Lucky",
"Miley Cyrus - Wrecking Ball",
"Lady Gaga - Applause",
"Miley Cyrus - Party in the USA",
"Avicii - Wake Me Up"
]
@rosiehoyem
rosiehoyem / jukebox.rb
Created October 13, 2013 17:32
Debug TODO, Day 12
require_relative './song_library.rb'
def jukebox(command)
if command.downcase == "list"
list_library
else
parse_command(command)
end
end
@rosiehoyem
rosiehoyem / handshake.rb
Created October 13, 2013 17:44
Secret Handshake TODO, Day 12
class SecretHandshake
attr_accessor :signal
def initialize(signal=str)
@@commands = []
@@commands << "wink" if @signal.include?(/"1"/)
end
end