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
set :application, "yyyyyyyyyyy" | |
set :repository, "here-be-your-githubs" | |
set :scm, :git | |
set :branch, "master" | |
set :user, "xxxxxxxx" | |
set :scm_verbose, true | |
default_run_options[:pty] = true | |
set :deploy_via, :remote_cache | |
ssh_options[:forward_agent] = true |
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
# you generally only need one nginx worker unless you're serving | |
# large amounts of static files which require blocking disk reads | |
worker_processes 1; | |
user nobody nogroup; # for systems with a "nogroup" | |
pid /tmp/nginx.pid; | |
error_log /tmp/nginx.error.log; | |
events { | |
worker_connections 1024; |
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 is for mongoid, so the active-record stuff is commented out. | |
#### Uncomment in before/after fork to make this happy | |
worker_processes 4 | |
user "unprivileged_user", "unprivileged_group" | |
working_directory "/u/apps/yourappdirectory/current" # available in 0.94.0+ | |
listen "/tmp/.sock", :backlog => 64 | |
listen 8080, :tcp_nopush => true |
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
# Houston Ruby group solution for http://codekata.pragprog.com/2007/01/kata_four_data_.html | |
require 'rspec' | |
class CalculateSpread | |
def for_file(filename) | |
smallest_day, smallest_spread = nil, infinity | |
File.readlines(filename).each do |line| | |
next unless valid_line?(line) |
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 Api::BaseController < ApplicationController | |
respond_to :json | |
skip_before_filter :protest_sopa | |
protected | |
def unauthorized! | |
render :text=>"Unauthorized Action", :status=>:unauthorized | |
end | |
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
#http://jessewolgamott.com/blog2012/02/29/the-one-where-we-dry-up-mongoid-and-rspec-using-shared-examples-and-modules/ | |
require 'spec_helper' | |
module Contactable | |
def self.included(receiver) | |
receiver.class_eval do | |
field :first_name, type: String | |
field :last_name, type: String |
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 AdminDomain | |
def self.matches?(request) | |
request.subdomain =~ /admin/ | |
end | |
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
--colour | |
-I app |
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 Message | |
def deliver_to(mailbox) | |
mailbox.new_mail(self) | |
end | |
end | |
class Mailbox | |
def initialize |
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 'active_record' | |
require 'logger' | |
ActiveRecord::Base.logger = Logger.new(STDERR) | |
ActiveRecord::Base.establish_connection( | |
adapter: "sqlite3", | |
database: ":memory:" | |
) |