Skip to content

Instantly share code, notes, and snippets.

View rosiehoyem's full-sized avatar

Rosie Hoyem rosiehoyem

View GitHub Profile
@rosiehoyem
rosiehoyem / FizzBuzz
Last active December 23, 2015 23:59
FizzBuzz assignment, Sept 25
def fizzbuzz(*num)
num.each do |x|
if x % 3 == 0 && x % 5 == 0
return "FizzBuzz"
elsif x % 3 == 0
return "Fizz"
elsif x % 5 == 0
return "Buzz"
else
return x
@rosiehoyem
rosiehoyem / Quiz - Sept 25
Created September 26, 2013 12:34
Exercise from Sept 25.
# Write a program that tells you the following:
#
# Hours in a year. How many hours are in a year?
# Minutes in a decade. How many minutes are in a decade?
# Your age in seconds. How many seconds old are you?
#
# Define at least the following methods to accomplish these tasks:
#
# seconds_in_minutes(1)
# minutes_in_hours(1)
@rosiehoyem
rosiehoyem / Tweet Shortener
Last active December 24, 2015 02:09
Homework, Day 4
=begin
Write a method that will take a tweet, search it for
words that you can substitute, and return a substituted string
tweet. For instance, the tweet "Hello to you, I'm at home"
would become "Hi 2 u, I'm @ home". The client has provided
the following acceptable substitutes. => e
Objectives
1. Write a method to shorten a string based on the allowed substitutes
@rosiehoyem
rosiehoyem / Conference Badges
Last active December 24, 2015 02:09
Ruby homework, day 4
=begin
1. print phrases with names
2. create array with phrases
3. assign rooms to speakers
4. create another array with speaker welcome
=end
# "Hello, my name is _____."
name = ["Edsger", "Ada", "Charles", "Alan", "Grace", "Linus", "Matz"]
@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
@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 / 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 / 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 / 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