Skip to content

Instantly share code, notes, and snippets.

View vanmichael's full-sized avatar

van nguyen vanmichael

  • OpenTable
  • San Francisco
View GitHub Profile
#All I need in life are my favorite movies and an array of hash.
favorite_movies = [
{ title: 'The Big Lebowski', year_released: 1998, director: 'Joel Coen', imdb_rating: 8.2 },
{ title: 'The Shining', year_released: 1980, director: 'Stanley Kubrick', imdb_rating: 8.5 },
{ title: 'Troll 2', year_released: 1990, directory: 'Claudio Fragasso', imdb_rating: 2.5 }
]
favorite_movies.each do |movie|
puts "#{movie[:year_released]}: #{movie[:title]}"
@vanmichael
vanmichael / echo.rb
Last active December 29, 2015 05:39
Phase 1
#Echo Phase 1
class Echo
def initialize
get_input
play_back(@input)
end
def get_input
@vanmichael
vanmichael / echo.rb
Created November 24, 2013 18:20
Phase 2
#Echo Phase 2
class Echo
def initialize
get_input
if @input == "Nothing!"
puts "Ok, fine!"
elsif @input == "I have a lot to say"
@vanmichael
vanmichael / echo.rb
Last active December 29, 2015 06:48
Phase 3
#Echo Phase 3
class Echo
def initialize
get_input
if @input == "Nothing!"
puts "Ok, fine!"
elsif @input == "I have a lot to say"
respond_to_alot
@vanmichael
vanmichael / echo.rb
Created November 25, 2013 02:43
Phase 4
#Echo Phase 4
class Echo
def initialize
@comments = []
get_input
if @input == "Nothing!"
puts "Ok, fine!"
elsif @input == "I have a lot to say"
@vanmichael
vanmichael / game_of_thrones.rb
Created November 25, 2013 02:48
Add your name to the Game of Thrones List!
require 'pry'
class House
attr_reader :character, :house, :selection
def initialize
@characters = {
"Tyrion Lannister" => "House Lannister",
"Jon Snow" => "Night's Watch",
@vanmichael
vanmichael / change_machine.rb
Created November 25, 2013 12:56
Kata Change Machine
#The Change Machine
#by van
class Change
attr_reader :dollars, :quarters, :dimes, :pennies, :change
def initialize
get_amount_due
get_amount_tendered
#By Van and Collin
require './register.rb'
require 'pry'
cashier = Register.new
cashier.load_products("products.csv")
while cashier.get_selection != 'done'
if cashier.menu_selection == '1'
while cashier.get_item != 'done' do
@vanmichael
vanmichael / card_quick_challenge.rb
Created November 26, 2013 15:02
Card Quick Challenge for Launch Academy
class Card
def initialize(rank = nil, suit = nil)
if suit.nil?
@suit = ['♠', '♣', '♥', '♦'].sample
else
@suit = suit
end
if rank.nil?
@rank = ['2','3','4','5','6','7','8','9','10','J','Q','K'].sample
else
class television
def initialize(model, size, color)
@model = model
@size = size
@color = color
end
end
class channel(number,broadcaster)
def initialize(number,broadcaster)