Skip to content

Instantly share code, notes, and snippets.

View blake41's full-sized avatar

Blake Johnson blake41

  • http://blakejohnson.brandyourself.com/
View GitHub Profile
require 'pry'
require 'pry-nav'
class Person
def initialize(att)
self.class.class_eval do
att.each do |method, value|
define_method(method) do
instance_variable_get("@#{method}")
end
# All bicycles are road bikes
# A Mechanic is going to need to know what spare parts to take
# for a bike on a trip in case it breaks down
# tape color is the only dynamic component of spares
############## Page 107 ##############
class Bicycle
attr_reader :size, :tape_color
def initialize(args)
@size = args[:size]
@blake41
blake41 / tickets
Last active August 29, 2015 14:27
a person should be able to purchase a ticket to a show
they should be able to attend multiple shows
we should keep track of how many unused tickets a person has
we should keep track of how many used tickets a person has
we should be able to use a ticket (go to a show)
Alexander Burton
Andrew Persad
Brian Mesa
Bruna Netto
Carson Crane
Christopher Dabalsa
Damian Lajara
Djavan Joseph
Dylan O'Keefe
Esther Mohadeb
require 'pry'
def second_supply_for_fourth_of_july(holiday_hash)
# given that holiday_hash looks like this:
# {
# :winter => {
# :christmas => ["Lights", "Wreath"],
# :new_years => ["Party Hats"]
# },
# :summer => {
def reformat_languages(languages)
result = {}
languages.each_pair do |style, values|
# style like :oo
# values like {
# :javascript => {
# :type => "interpreted"
# }
values.each_pair do |language, attributes|
# language is like :javascript
def reformat_languages(languages)
result = {}
languages.each_pair do |style, values|
# style like :oo
# values like {
# :javascript => {
# :type => "interpreted"
# }
values.each_pair do |language, attributes|
# language is like :javascript
require 'pry'
require 'pry-nav'
require 'ap'
pigeon_data = {
:color => {
:purple => ["Theo", "Peter Jr.", "Lucky"],
:grey => ["Theo", "Peter Jr.", "Ms. K"],
:white => ["Queenie", "Andrew", "Ms. K", "Alex"],
:brown => ["Queenie", "Alex"]
# Count words in a sentence
require 'pry-nav'
require "pry"
require 'ap'
paragraph = <<-something
Steven likes the movies. Blake likes to ride his bike but hates movies.
Blake is taller than steven. Steven is a great teacher.
something
sentence = <<-something
Steven likes the movies. Blake likes to ride his bike but hates movies.
Blake is taller than steven. Steven is a great teacher.
something
sentence = sentence.gsub("."," ") # you can chain more then one gsub
sentence = sentence.split(" ").collect {|word| word.capitalize}
cont = {}