Skip to content

Instantly share code, notes, and snippets.

View krokrob's full-sized avatar
🥞
Data Warehousing

Kevin ROBERT krokrob

🥞
Data Warehousing
View GitHub Profile
# todo
# class restaurant
class FastFood
attr_reader :name
def initialize(name, city, prep_time)
@name = name
@city = city
@prep_time = prep_time
end
class Restaurant
attr_reader :name
def initialize(name, city)
@name, @city = name, city
end
def to_s
return "Welcome to #{@name}, in #{@city}"
end
end
class Restaurant
attr_reader :name
def initialize(name, city)
@name, @city = name, city
end
def self.categories
return %w(fast-food gastronomic traditional)
end
class Chief
attr_reader :name, :restaurant
def initialize(name, age, restaurant)
@name = name
@age = age
@restaurant = restaurant
end
end
class Restaurant
# Here is the game!
require 'gosu'
require_relative 'player'
require_relative 'star'
module ZOrder
Background, Stars, Player, UI = *0..3
end
require 'gosu'
class Player
attr_reader :score
def initialize
@image = Gosu::Image.new("images/xwing.png")
@x = @y = @vel_x = @vel_y = @angle = 0.0
@score = 0
end
require 'gosu'
class Star
attr_reader :x, :y
def initialize(animation)
@animation = animation
@color = Gosu::Color.new(0xff_000000)
@color.red = rand(256 - 40) + 40
@color.green = rand(256 - 40) + 40
@krokrob
krokrob / filterable.rb
Created February 16, 2016 09:09 — forked from justinweiss/filterable.rb
Filterable
# Call scopes directly from your URL params:
#
# @products = Product.filter(params.slice(:status, :location, :starts_with))
module Filterable
extend ActiveSupport::Concern
module ClassMethods
# Call the class methods with the same name as the keys in <tt>filtering_params</tt>
# with their associated values. Most useful for calling named scopes from
require "date"
DPT = {
"76" => "Seine-Maritime",
"75" => "Paris"
}
REG_SSN = /^(?<gender>1|2)(?<year>\d{2})(?<month>0[1-9]|1[0-2])(?<zip>\d{2})\d{6}(?<key>\d{2})/
def ssn_info(ssn)
class Restaurant
attr_reader :name, :city, :chief
def initialize(name, city, chief_first_name, chief_last_name, chief_exp)
@name, @city = name, city
@chief = Chief.new(chief_first_name, chief_last_name, chief_exp, self)
end
def welcome
return "Welcome to #{@name}"
end