Skip to content

Instantly share code, notes, and snippets.

View mattsoutherden's full-sized avatar

Matt Southerden mattsoutherden

View GitHub Profile
# /home/bob/env
# USER=bob
# PASS=secret
docker run --env-file /home/bob/env -p 80:80 some/image
# Which is equivalent to:
docker run -e USER=bob -e PASS=secret /path/to/file -p 80:80 some/image
def foo([head | *something*]) when head * 2 < *last* do
some return value
end
Name: Performance#description should replace an obscene description with an innocent one
Type: Failure Message:
expected: "Me performing care bear on my teddy",
got: "Me performing cunillingus on my teddy"
Name: Performance#title should replace an obscene title with an innocent one
Type: Failure Message:
expected: "care bear",
got: "fingerfuckers" (using ==) ./spec/wired/app/models/performance_spec.rb:763:
beans = [:arabica, :robusta]
beans.reject { |type| type == :robusta }
beans.flatten!
beans.compact!
espresso = beans.inject(:steam) {}
frapuccino = ([[:milk]] << [espresso]).freeze
frapuccino.take_while { |cup| !cup.empty? }
<emotionml xmlns="http://www.w3.org/2009/10/emotionml"
xmlns:classifiers="http://www.example.com/meta/classify/"
xmlns:origin="http://www.example.com/meta/local/"
category-set="http://www.example.com/emotion/category/everyday-emotions.xml">
<info>
<classifiers:classifier classifiers:name="GMM"/>
</info>
<emotion>
<intensity value="1"/>
class FbappController < ApplicationController
helper :google_optimizer
skip_before_filter :invitation_or_login_required, :only => [:index]
layout 'fb_app'
def index
if @user
return redirect_to '/fb_error'
end
class InviteController < ApplicationController
helper :google_optimizer, :content, :competitions, :deals
include ContentHelper
skip_before_filter :invitation_or_login_required, :only => [ :index, :invite_deal, :invite_competition]
def index
#########################################
## Generic links
<p>
<span class="black-txt"><b>Programme Benefits</b></span><br />
<span class="black-txt">• High conversion rate and average spend (£77) per customer</span><br />
<span class="black-txt">• Fantastic widget feeds and creatives to display on your website</span><br />
<span class="black-txt">• Comprehensive Affiliate management from 7thingsmedia</span><br />
</p>
<p>
<span class="black-txt">• £2.50 fixed fee commission for first customer sales</span><br />
<span class="black-txt">• 10% commission of sale value on first customer sales</span><br />
@mattsoutherden
mattsoutherden / gist:1200438
Created September 7, 2011 12:29
Strange Ruby Behaviour
>> d.wordpress_deal.merchant_value
=> 37.05
>> d.wordpress_deal.merchant_value * 100
=> 3705.0
>> (d.wordpress_deal.merchant_value * 100).to_i
=> 3704
>>
@mattsoutherden
mattsoutherden / routes.rb
Created December 14, 2011 12:37
Rails 3 Routing
# Rails 2 routing
#
map.resource :city, :as => ":city" do |city|
city.login 'login', :controller => 'cities', :action => 'login'
city.resources :orders, :only => [ :show, :update ]
end
# city_login /:city/login {:controller=>"cities", :action=>"login"}
#
# city_order GET /:city/orders/:id(.:format) {:controller=>"orders", :action=>"show"}