Skip to content

Instantly share code, notes, and snippets.

def checkout
cart =, params)!
rescue OutOfStock => e
redirect_to cart_path, notice: t('.failure', reason: cart.error_message)
rescue CartError
redirect_to cart_path, notice: t('.failure', reason: cart.error_message)
<a href="//" class="buffer-add-button" data-count="vertical">Buffer</a>
<script type="text/javascript" src="//"></script>
gma / Gemfile
Created February 4, 2013 15:42 — forked from datenimperator/Gemfile
source ''
gem 'nesta', '~> 0.9.13'
gem 'haml'
gem 'haml-coderay'
gem 'sass'
gem 'compass'
gem 'sprockets-sass'
gma / soc-to-the-max.rb
Created July 17, 2012 09:55 — forked from rlivsey/soc-to-the-max.rb
Separation of concerns sketch
class TasksController < ApplicationController
def complete
# add responder as listener, or could subscribe etc...
# task could be the actual task, or pass through the ID
gma / app.rb
Created July 20, 2011 15:57
app.rb for legibilis
module Nesta
class App
get '/robots.txt' do
content_type 'text/plain', :charset => 'utf-8'
# robots.txt
# See
/* Multiget web service, written in Node,
Will fetch all URLs in parallel, then return a JSON response containing
the fetched content from them.
var DEFAULT_TIMEOUT = 10000;
gma / gist:234446
Created November 14, 2009 08:43 — forked from jc00ke/gist:234265
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
module UserSpecHelper
def valid_user_attributes
{ :username => 'jc00ke',
:email => '',
:password => 'p@ssw0rd' }
def invalid_usernames
# This isn't as elegant as some of the other solutions for running multiple versions
# of Ruby but it's simple, straight-forward and has worked well for me so far. I'm
# currently running the most recent stable versions of 1.8.5, 1.8.6, 1.8.7, and
# 1.9.1 and plan to experiment with some patched versions as well.
# pull one of the tarballs down and extract:
$ cd /tmp
$ curl |
tar xvzf -
$ cd ruby-1.9.1-p0