Skip to content

Instantly share code, notes, and snippets.

chosen_names = []
fav_cat_names.each do |name|
break if name == "Johnny Cochran"
chosen_names << name
end
chosen_names
fav_cat_names.map do |name|
break if name == "Johnny Cochran"
name
end
def test(cat)
cat.map(&:name)
end
#-sinatra server
# -spotify module
# -spotify gem
# -attributes and methods: search, play
# -playlister object
# -include/extend spotify module
# -creates song objects from the spotify search data
# -methods: sort, list,
def initialize(attributes)
attributes.each do |attribute, value|
self.class.send(:define_method, attribute) do
@attribute = value
end
end
end
end
class Integer
@@roman_numerals = {
1000 => "M",
900 => "CM",
500 => "D",
400 => "CD",
100 => "C",
90 => "XC",
50 => "L",
40 => "XL",
def is_a_vowel?(v)
'aeiou'.include?(v)
end
class TriangleError < Exception
end
class Triangle
attr_reader :side1, :side2, :side3
def initialize(side1, side2, side3)
@side1 = side1
@side2 = side2
@side3 = side3
class School
attr_reader :roster,:school
def initialize(school)
@school = school
@roster = {}
end
def roster
@roster
class Jukebox
attr_accessor :songs
DefaultSongs = [
"The Phoenix - 1901",
"Tokyo Police Club - Wait Up",
"Sufjan Stevens - Too Much",
"The Naked and the Famous - Young Blood",
"(Far From) Home - Tiga",
"The Cults - Abducted",