Skip to content

Instantly share code, notes, and snippets.

View matt297's full-sized avatar

Matt Hennessy matt297

View GitHub Profile
@matt297
matt297 / song_class_example.rb
Created November 15, 2016 00:27
Lighthouse Labs - Intro to Web Dev - W4D1 - Oct 2016 Cohort
class Song
def initialize(title)
@title = title
end
def play
puts "Now playing #{@title}"
end
@matt297
matt297 / yellowpage_class_solution.rb
Created November 8, 2016 02:08
Lighthouse Labs - Intro to Web Dev - W3D1 - Oct 2016 Cohort
def map_letters_to_numbers(user_input)
user_output = ""
user_input.upcase!
if user_input.length == 10
user_input.each_char do |letter|
case letter
when("A".."C") then user_output += "2"
when("D".."F") then user_output += "3"
@matt297
matt297 / yellowpager.rb
Last active November 8, 2016 01:12
Lighthouse Labs - Intro to Web Dev - W3D1
# Courtesy of https://ide.c9.io/brendandeere/yellowpager
# Write a method called "yellowpager" that accepts a 10-character string of
# letters and outputs a corresponding phone number string. If the input letter
# string isn't 10 characters, you should return false. Not valid.
# 2 -> A B C
# 3 -> D E F
# 4 -> G H I
# 5 -> J K L
@matt297
matt297 / fizzbuzz_class_solution.rb
Last active November 8, 2016 01:00
Lighthouse Labs - Intro to Web Dev - W2D2 - Oct 2016 Cohort
def number_label(number)
if number % 5 == 0 && number % 3 == 0
"#{number} FIZZBUZZ"
elsif number % 5 == 0
"#{number} BUZZ"
elsif number % 3 == 0
"#{number} FIZZ"
@matt297
matt297 / fizzbuzz.rb
Last active November 2, 2016 23:32 — forked from sarahca/fizzbuzz.rb
Lighthouse Labs - Intro to Web Dev - W2D2
# Our program should
# - make a list of numbers from 1 to 100 (inclusive)
# - for each number:
# print "Fizz" if divisible by 3
# print "Buzz" if divisible by 5
# print "FizzBuzz" if divisible by 3 AND 5
# otherwise, print the number
# uncomment the block of code you want to run to test each version
@matt297
matt297 / ruby_examples.rb
Last active November 14, 2021 04:29 — forked from MaggieMoss/ruby-examples.rb
Lighthouse Labs - Intro to Web Dev - W2D2
# STRINGS
# # we can use double quotes
puts "This is a string."
# # or we can use single quotes
puts 'This is a string with single quotes.'
# # adding two strings together
puts 'Hello, ' + "Maggie."
#INTEGER
#we can add them