Skip to content

Instantly share code, notes, and snippets.

View matoni109's full-sized avatar

Chris matoni109

View GitHub Profile
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
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
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)
class Animal
def name(name)
@name = name
# TODO: what should this method return?
self
end
def species(species)
@species = species
class Animal
def name(name)
@name = name
# TODO: what should this method return?
self
end
def species(species)
@species = species
require 'gosu'
# require_relative 'player'
# require_relative 'star'
module ZOrder
BACKGROUND, STARS, PLAYER, UI = *0..3
end
class Tutorial < Gosu::Window
def initialize
require 'gosu'
# require_relative 'player'
# require_relative 'star'
module ZOrder
BACKGROUND, STARS, PLAYER, UI = *0..3
end
class Tutorial < Gosu::Window
def initialize
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)
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
require 'csv'
require_relative '../models/meal'
require "pry-byebug"
# ../../data
class MealRepository
# ID and NAME and CURED and ROOM_ID
def initialize(csv_file)