Skip to content

Instantly share code, notes, and snippets.

class Song
def initialize(name, artist, duration)
@name = name
@artist = artist
@duration = duration
end
def to_s
"Song: #{@name} --#{@artist} (#{@duration})"
end
# This viminfo file was generated by Vim 7.3.
# You may edit it if you're careful!
# Value of 'encoding' when this file was written
*encoding=utf-8
# hlsearch on (H) or off (h):
~h
# Last Search Pattern:

Chapter 1

Summarize the chapter ( 1+ bullets )

  • The chapter is talking about how secondary school is broken. It explains how school is like a prison intended to keep children busy while the adults are at work.
  • Nerds are ahead of the game because they want to don't want to play the game being played in secondary school. They want to work on real problems.

What was one idea the surprised or stood out to you? Why? ( 2-4 sentences )

@austenito
austenito / integration_spec.rb
Created April 11, 2012 12:50
Integration Testing w/ Sorcery
describe "Shopping Cart Requests" do
let!(:user) { Fabricate(:user) }
before(:each) do
login_user_post("admin", "admin")
end
context "when I visit the shopping cart" do
it " show the logged in users' cart items " do
#Test stuff
require 'spec_helper'
describe "Order Summary" do
context "When I am on the order summary page" do
it "shows the shipping address for the order" do
visit new_shipping_address_path
fill_in "First name", :with => "Jeff"
fill_in "Last name", :with => "Casimir"
fill_in "Company", :with => "Jumpstart Lab"
fill_in "Street", :with => "1445 New York Ave NW"
@austenito
austenito / gist:2418746
Created April 19, 2012 05:09
post for two-click
jQuery ->
$('#two-click-submit').click ->
$.post(
"/two_click"
foo: $('#cart_item_quantity').val()
-> alert("omg")
)
@austenito
austenito / cart.rb
Created May 5, 2012 13:38
Updated carts controller
class Cart < ActiveRecord::Base
belongs_to :user
has_many :cart_products
has_many :products, :through => :cart_products
def product_count
cart_products.pluck(:quantity).sum
end
def add_product(product_id)
require 'spec_helper'
describe Article do
let(:article) { Fabricate(:article) }
[:title, :body].each do |attribute|
it "is not valid without a #{attribute}" do
article.update_attributes(attribute => nil)
subject.should_not be_valid
end