Skip to content

Instantly share code, notes, and snippets.

View steven-ferguson's full-sized avatar

steven-ferguson

  • Dave
  • Los Angeles, CA
View GitHub Profile
@steven-ferguson
steven-ferguson / gist:9083414
Last active August 29, 2015 13:56
Book Data Merger
require 'json'
class BookMetaMerge
def initialize(output_file='result_example.file')
@output_file = output_file
end
def merge_files(file1, file2)
hash_one = JSON.parse(file1)
hash_two = JSON.parse(file2)
class Die
def initialize(number_of_sides)
@number_of_sides = number_of_sides
end
def sides
@number_of_sides
end
def roll
require 'date'
class Task
def initialize(description)
@description = description
@status = "incomplete"
@priority = 5
@due_date = Date.today.to_s
end
require './lib/triangles'
def main
@sides = []
puts "Please enter a side length"
@sides << gets.chomp
puts "Please enter another side length"
@sides << gets.chomp
puts "Please enter a third side length"
class Parcel
def initialize(weight, height, width, length)
@weight = weight
@height = height
@width = width
@length = length
@dimensional_weight = (@length * @width * @height)/ 166
end
def dimensional_weight
class Address
def initialize
@street
@city
@state
@type
end
def complete_address
"#{@street} #{@city}, #{@state}"
class Board
def initialize(grid_length)
@spaces = []
@grid_length = grid_length
create_spaces
end
attr_reader :spaces, :grid_length
def create_spaces
class Board
attr_reader :columns, :height, :width
def initialize(width, height)
@columns = []
@height = height
@width = width
width.times do |position|
column = Column.new(position, height)
columns << column
class List
attr_reader :name, :id
def initialize(name)
@name = name
end
def ==(another_list)
self.name == another_list.name
class Address
attr_reader :contact_id, :street, :city, :state, :zip, :type, :full
def initialize(contact_id, street, city, state, zip, type="")
@contact_id = contact_id
@street = street
@city = city
@state = state
@zip = zip
@type = type