Skip to content

Instantly share code, notes, and snippets.

View allcentury's full-sized avatar
🎈

Anthony Ross allcentury

🎈
View GitHub Profile
@allcentury
allcentury / cashregister1.rb
Created February 18, 2014 17:07
Cash Register 1
#User story: As a cashier
#I want to calculate the change due
#So I know how much to give back to the customer
t = Time.now
puts "What is the amount due?"
amount_due = gets.chomp.to_f
puts "What is the amount tendered?"
@allcentury
allcentury / roundrobin.rb
Created February 18, 2014 20:36
Round Robin
studentsarray = ["Anthony", "Greg", "Dan", "Rohan", "Lydia", "Lee", "Chris", "Charlie", "Barry", "Julissa", "Victor", "Arnold"]
def groupsplit(array)
group1 = []
group2 = []
array.each_with_index do |x, i|
if i >= (array.length / 2)
group1 << x
else
group2 << x
@allcentury
allcentury / cashregister2.rb
Last active August 29, 2015 13:56 — forked from gsheppard/cashregister2.rb
Cash Register II w/ Methods
=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
def sub_total(array)
subtotal_amt = 0.0
array.each do |x|
subtotal_amt += x
characters = {
"Tyrion Lannister" => "House Lannister",
"Jon Snow" => "Night's Watch",
"Hodor" => "House Stark",
"Stannis Baratheon" => "House Baratheon",
"Theon Greyjoy" => "House Greyjoy"
}
characters.each do |key, value|
puts "#{key} represents the #{value}"
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 |value|
puts "#{value[:year_released]}: #{value[:title]}"
end
test_scores = [75, 100, 85, 65, 84, 87, 95]
def avg(array)
sum = 0.0
array.each do |x|
sum += x
end
(sum / array.length).round(2)
end
@allcentury
allcentury / shoppinglist.log
Created February 22, 2014 21:48
Shopping List Log
commit 9bd028731a8f3c71ba0c93b80bb4c0c85af0adad
Author: Anthony Ross <anthony.s.ross@gmail.com>
Date: Sat Feb 22 16:43:10 2014 -0500
made minor change to list to test git
commit fda290c9c66e54b7ef9ea827342ade43b05dabef
Author: Eric Kelly <heroiceric@gmail.com>
Date: Mon Apr 29 06:21:42 2013 -0400
class Car
def initialize(color, owner, cylinders)
@color = color
@owner = owner
@cylinders = cylinders
end
def color
@color
end
require 'rubygems'
require 'csv'
require 'json'
require 'pry'
require 'oauth'
consumer_key = ''
consumer_secret = ''
token = ''
token_secret = ''
require 'pp'
require 'pry'
require 'csv'
class Importer
def self.get(filename)
violations = []
CSV.foreach(filename, headers: true) do |csv|
violations << Violation.new(
csv[0],