This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def colorful? (number) | |
colorful_numbers = [ 0, 1, 23, 263, 987 ] | |
#not_colorful_numbers = [ 10, 236, 999 ] | |
if number != number.to_i | |
return false | |
elsif colorful_numbers.include?(number) | |
return true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def visa?(card) | |
# TODO: A visa card starts with a 4 | |
if card.gsub(" ", "")[0] == "4" && card.gsub(" ", "").length == 16 | |
return true | |
else | |
return false | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Restaurant | |
# TODO: add relevant accessors if necessary | |
attr_reader :average_rating, :city | |
attr_writer :ratings # :restaurants | |
def self.filter_by_city(restaurants, city) | |
restaurants.select{|rest| rest.city == city } | |
end | |
def initialize(city, name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal | |
def name(name) | |
@name = name | |
# TODO: what should this method return? | |
self | |
end | |
def species(species) | |
@species = species |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal | |
def name(name) | |
@name = name | |
# TODO: what should this method return? | |
self | |
end | |
def species(species) | |
@species = species |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'gosu' | |
# require_relative 'player' | |
# require_relative 'star' | |
module ZOrder | |
BACKGROUND, STARS, PLAYER, UI = *0..3 | |
end | |
class Tutorial < Gosu::Window | |
def initialize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'gosu' | |
# require_relative 'player' | |
# require_relative 'star' | |
module ZOrder | |
BACKGROUND, STARS, PLAYER, UI = *0..3 | |
end | |
class Tutorial < Gosu::Window | |
def initialize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
require_relative 'recipe' | |
class Cookbook # or DATABASE | |
attr_reader :recipes | |
def initialize(csv_filepath) | |
@recipes = [] # array of Task Instances | |
@csv_filepath = csv_filepath | |
load_csv(@csv_filepath) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
require 'json' | |
def generate_grid(grid_size) | |
# TODO: generate random grid of letters | |
gen_grid = ('A'..'Z').to_a + ('A'..'N').to_a | |
gen_grid.sample(grid_size) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
require_relative '../models/meal' | |
require "pry-byebug" | |
# ../../data | |
class MealRepository | |
# ID and NAME and CURED and ROOM_ID | |
def initialize(csv_file) |
OlderNewer