Skip to content

Instantly share code, notes, and snippets.

View gsheppard's full-sized avatar

Gregory Sheppard gsheppard

View GitHub Profile
# report average, lowest, and highest scores
require 'pry'
def bubble_sort scores
bubbled = scores
outer = 0
while outer < bubbled.length - 1
inner = 0
while inner < bubbled.length - 1
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]}"
end
characters = {
"Tyrion Lannister" => "House Lannister",
"Jon Snow" => "Night's Watch",
"Hodor" => "House Stark",
"Stannis Baratheon" => "House Baratheon",
"Theon Greyjoy" => "House Greyjoy"
}
characters.each {|k,v| puts "#{k} represents the #{v}"}
@gsheppard
gsheppard / shopping_list.log
Created February 20, 2014 23:26
Shopping List Git Log file
commit acde6f45925d826a55b9e2e3164531706520a4f0
Author: Gregory Sheppard <gregory.sheppard@live.com>
Date: Thu Feb 20 18:16:54 2014 -0500
Add new list item
commit 55c13e12b78cb3f2ef316267f94e80c479c74a12
Author: Gregory Sheppard <gregory.sheppard@live.com>
Date: Thu Feb 20 18:15:31 2014 -0500
@gsheppard
gsheppard / cashregister2.rb
Last active August 29, 2015 13:56
Cash Register II
=begin
As a cashier
I want to enter the sale price of each item
So that the program will calculate the amount due
Developed by: Anthony Ross, Dan Clarke, and Greg Sheppard
=end
item = ''
trans = []
subtotal = 0
#Guess the Number
#Coded by: Anthony Ross, Greg Sheppard, Dan Clark
MAX = 1000
puts "Guess a number between 0 and #{MAX}: "
guess_num = -1
winning_num = rand(MAX)
while guess_num != winning_num