Skip to content

Instantly share code, notes, and snippets.

View patricksrobertson's full-sized avatar

Patrick Robertson patricksrobertson

View GitHub Profile
@patricksrobertson
patricksrobertson / publish.feature
Created January 11, 2011 18:11
Publishing a Video Paper
Feature:
In order to better utilize Video Paper Builder
As an owner of a Video Paper
I want to be able to publish and un-publish Video Papers.
Scenario: Publishing "Unpublished Paper" makes it visible to a shared user
Given I am a user logged in as "[email protected]"
When I go to Unpublished Paper's video paper page
Then I share "Unpublished Paper" with "[email protected]"
When I go to my video papers page
Feature:
In order to better utilize Video Paper Builder
As an owner of a Video Paper
I want to be able to publish and un-publish Video Papers.
Scenario: Publishing "Unpublished Paper" makes it visible to a shared user
Given I am a user logged in as "[email protected]"
When I go to Unpublished Paper's video paper page
Then I share "Unpublished Paper" with "[email protected]"
When I go to my video papers page
And I follow "Publish" within "Unpublished Paper"
Given I am a user logged in as "[email protected]"
When I go to Unpublished Paper's video paper page
Then I should be on Unpublished Paper's video paper page
@patricksrobertson
patricksrobertson / cupid_button.sass
Created February 10, 2011 19:20
Sassifies the cupid-button done by GIANT ROBOTS. This is really a .scss . Github doesn't recognize it.
//Mixin that allows someone to define Cupid buttons outside of the green colors.
// $main-color: Primary button color.
// $btn-gradient: lighter color to blend with the main color.
// $bottom-border: Darker color for the bottom part of the button.
// $box-shadow: Color for the shadow.
// $text-shadow: Color for the text shadow.
// $text-color: Main color for the text.
@mixin cupid-button($main-color: #7fbf4d, $btn-gradient: #63a62f,
$bottom-border: #5b992b, $box-shadow: #96ca6d, $text-shadow: #4c9021,$text-color: #fff ) {
background: $main-color;
@patricksrobertson
patricksrobertson / twitter_oauth.rb
Created February 14, 2011 21:04
Two options for named routing with dynamic paths.
##
# Option #1: Hacking the routes file.
##
#config/routes.rb
match ‘auth/:provider/callback’ => ‘authentications#create’
match ‘auth/twitter/callback’ => ‘authentications#create’, :as => :twitter_callback
##
# Option #2: Using cucumber web steps
# app/models/post.rb
class Post < ActiveRecord::Base
has_one :comment
def name
"I'm overriding a delegated method!"
end
end
# app/models/comment.rb
# Scope standing on its own.
scope :featured, where(:featured => true).limit(5)
# Scope using another scope
scope :featured_with_comments, featured.includes(:comments)
// Vagrant Virtual box that can't do gem install <gem> as of today
traceroute to rubygems.org (72.4.120.124), 30 hops max, 60 byte packets
1 * * *
2 192.168.1.1 (192.168.1.1) 1.660 ms 2.148 ms 2.503 ms
3 67.110.142.177.ptr.us.xo.net (67.110.142.177) 1.932 ms 2.191 ms 2.858 ms
4 ip65-47-145-149.z145-47-65.customer.algx.net (65.47.145.149) 5.469 ms 5.720 ms 6.459 ms
5 ge11-1-4d0.mcr2.cambridge-ma.us.xo.net (216.156.7.21) 6.130 ms 6.649 ms 7.167 ms
6 ae1d0.mcr1.cambridge-ma.us.xo.net (216.156.1.13) 7.667 ms 8.152 ms 8.707 ms
class Coffee
def cost
3.00
end
end
class SprinkledCoffee
def initialize(coffee)
@base_cost = coffee.cost
end