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
# 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 ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p0.tar.gz | | |
tar xvzf - | |
$ cd ruby-1.9.1-p0 |
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 File.expand_path(File.dirname(__FILE__) + '/../spec_helper') | |
module UserSpecHelper | |
def valid_user_attributes | |
{ :username => 'jc00ke', | |
:email => 'jc00ke@example.com', | |
:password => 'p@ssw0rd' } | |
end | |
def invalid_usernames |
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
/* Multiget web service, written in Node | |
http://127.0.0.1:9001/?urls=http://example.com/,http://example.net/ | |
Will fetch all URLs in parallel, then return a JSON response containing | |
the fetched content from them. | |
*/ | |
var DEFAULT_TIMEOUT = 10000; |
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
module Nesta | |
class App | |
get '/robots.txt' do | |
content_type 'text/plain', :charset => 'utf-8' | |
<<-EOF | |
# robots.txt | |
# See http://en.wikipedia.org/wiki/Robots_exclusion_standard | |
EOF | |
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
class TasksController < ApplicationController | |
def complete | |
# add responder as listener, or could subscribe etc... | |
# task could be the actual task, or pass through the ID | |
task.add_subscriber(TaskCompletedResponse.new(self)) | |
task.add_subscriber(TaskEmail.new) | |
task.add_subscriber(TaskIndex) | |
task.complete_by(person) | |
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
source 'http://rubygems.org' | |
gem 'nesta', '~> 0.9.13' | |
gem 'haml' | |
gem 'haml-coderay' | |
gem 'sass' | |
gem 'compass' | |
gem 'sprockets-sass' |
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
# https://www.agileplannerapp.com/blog/building-agile-planner/refactoring-with-hexagonal-rails | |
def checkout | |
cart = CartCheckout.new(many, params) | |
cart.save! | |
rescue OutOfStock => e | |
OutOfStockNotification.new(e.line_item).deliver | |
redirect_to cart_path, notice: t('.failure', reason: cart.error_message) | |
rescue CartError | |
redirect_to cart_path, notice: t('.failure', reason: cart.error_message) | |
else |