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 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
# 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
#### 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
# 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
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
#!/bin/sh | |
set -u | |
set -e | |
# Example init script, this can be used with nginx, too, | |
# since nginx and unicorn accept the same signals | |
# Feel free to change any of the following variables for your app: | |
APP_ROOT=/home/deploy/public_html/rm/current | |
PID=$APP_ROOT/tmp/pids/unicorn.pid | |
ENV=production |
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_admin" | |
require "active_admin/resource_controller" | |
module ActiveAdmin | |
class Namespace | |
# Disable comments | |
def comments? | |
false | |
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
POST https://app.zencoder.com/api/v2/jobs HTTP/1.1 | |
Accept: application/json | |
Content-Type: application/json | |
{ | |
"api_key": "API_KEY_HERE", | |
"input": "PUBLIC_FILE_URL_HERE", | |
"private": true, | |
"output": [ | |
{ |
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 Burro < ActiveRecord::Base | |
#guacamole defined on schema | |
def delicious? | |
BurroDeliciousPolicy.new(self).delicious? | |
end | |
end |