Skip to content

Instantly share code, notes, and snippets.

View rosiehoyem's full-sized avatar

Rosie Hoyem rosiehoyem

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / anagram.rb
Created October 7, 2013 15:06
Anagram TO DO for Monday, October 7.
class Anagram
attr_accessor :word
def initialize(word)
@word = word
end
def match(array)
@word = @word.chars.sort
array.select { |element| element.chars.sort == @word }
@rosiehoyem
rosiehoyem / Pigeon Organizer
Created October 3, 2013 12:56
Hash homework day #8, pigeon organizer
########################
# NYC PIGEON ORGANIZER #
########################
pigeon_data = {
:color => {
:purple => ["Theo", "Peter Jr.", "Lucky"],
:grey => ["Theo", "Peter Jr.", "Ms .K"],
:white => ["Queenie", "Andrew", "Ms .K", "Alex"],
:brown => ["Queenie", "Alex"]
@rosiehoyem
rosiehoyem / Hash Homework - Day 6
Last active December 24, 2015 09:29
All homework from Sept 31st.
# A movie collection that organizes by genres
# Recipes with ingredients
# User profiles where each user has a list of favorite colors along
# with 3 personal essays, essay_1, essay_2, essay_3
movie_collection = {
:comedy => ["Dumb and Dumber", "Billy Madison", "American Pie"],
:action_adventure => ["Indiana Jones", "Die Hard", "Terminator"],
:documentary => ["Man on a Wire", "Exit Through the Gift Shop"]
}
@rosiehoyem
rosiehoyem / Vowels
Created September 27, 2013 13:10
Ruby homework, day 4.
=begin
Let's go back to the exercise where we determined what
is and isn't a vowel. With ruby, there's always more than
one way to do something and get the same result.
Assuming vowels a,e,i,o,u:
#1 Write a method that returns whether a given letter is a vowel,
using if and elsif