Skip to content

Instantly share code, notes, and snippets.

@foglabs
foglabs / Hash Movies Example
Last active August 29, 2015 14:05
Hash Movies Example
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 |element|
puts "#{element[:year_released]}: #{element[:title]}"
@foglabs
foglabs / Cash Register II
Last active August 29, 2015 14:05
Cash Register II
input = "beep"
subtotal_items = []
cash = 0
time = Time.now
#puts "Please enter the amount due: "
#price = gets.chomp.to_f
while input.downcase != "done"
@foglabs
foglabs / Cash Register I
Created August 12, 2014 17:12
Cash Register I
price = 0
cash = 0
time = Time.now
puts "Please enter the amount due: "
price = gets.chomp.to_f
puts "Please enter the cash tendered: "
cash = gets.chomp.to_f