This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
forms are HTML and follow HTTP conventions | |
forms are the combination of a get and a post | |
in sinatra we mainly build forms manually (in HTML) | |
in rails we mainly use "form helpers" to dynamically create forms | |
it's only the HTML you write that matters | |
the most important things about a form are the name attributes of the inputs and the action of the form. | |
the action of the form tells you where the form will post. | |
How does Sinatra/Rails parse query parameters (hint: it's really Rack doing it)? | |
http://spin.atomicobject.com/2012/07/11/get-and-post-parameter-parsing-in-rails-2/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Alexander Burton | |
Andrew Persad | |
Brian Mesa | |
Bruna Netto | |
Carson Crane | |
Christopher Dabalsa | |
Damian Lajara | |
Djavan Joseph | |
Dylan O'Keefe | |
Esther Mohadeb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |