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
#Deploy and rollback on Heroku in staging and production | |
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag'] | |
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag'] | |
namespace :deploy do | |
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU' | |
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU' | |
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag] | |
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on] |
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
# bangpound does not know Ruby. | |
# | |
# inspired by http://www.alloycode.com/2009/6/19/fun-with-rmagick | |
# | |
# RGBa PNG method described at http://leaverou.me/2009/02/bulletproof-cross-browser-rgba-backgrounds/ | |
module Sass::Script::Functions | |
def rgbapng(color) | |
require 'rubygems' | |
require "RMagick" |
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 Lisp | |
def initialize | |
@env = { | |
:label => lambda { |(name,val), _| @env[name] = val }, | |
:quote => lambda { |sexpr, _| sexpr[0] }, | |
:car => lambda { |(list), _| list[0] }, | |
:cdr => lambda { |(list), _| list.drop 1 }, | |
:cons => lambda { |(e,cell), _| [e] + cell }, | |
:eq => lambda { |(l,r), _| l == r }, | |
:if => lambda { |(cond, thn, els), ctx| eval(cond, ctx) ? eval(thn, ctx) : eval(els, ctx) }, |
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
// 17 standard colors are: aqua, black, blue, fuchsia, gray, grey, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow | |
$alice-blue: #F0F8FF | |
$antique-white: #FAEBD7 | |
$aqua: #00FFFF | |
$aquamarine: #7FFFD4 | |
$azure: #F0FFFF | |
$beige: #F5F5DC | |
$bisque: #FFE4C4 | |
$black: #000000 | |
$blanched-almond: #FFEBCD |
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
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |
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 playbook has been removed as it is now very outdated. |
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
# encoding : utf-8 | |
require 'openssl' | |
require 'digest/sha1' | |
require 'base64' | |
module Aws | |
extend self | |
def signed_url(path, expire_date) | |
digest = OpenSSL::Digest::Digest.new('sha1') | |
can_string = "GET\n\n\n#{expire_date}\n/#{S3_BUCKET}/#{path}" |
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 Enum < Hash | |
def initialize(*members) | |
super() | |
@rev = {} | |
members.each_with_index {|m,i| self[i] = m } | |
end | |
def [](k) | |
super || @rev[k] # || raise ArgumentError, "#{k} is not a member of this enum" | |
end | |
def []=(k,v) |
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
@PageSpinner = | |
spin: (ms=500)-> | |
@spinner = setTimeout( (=> @add_spinner()), ms) | |
$(document).on 'page:change', => | |
@remove_spinner() | |
spinner_html: ' | |
<div class="modal hide fade" id="page-spinner"> | |
<div class="modal-head card-title">Please Wait...</div> | |
<div class="modal-body card-body"> | |
<i class="icon-spinner icon-spin icon-2x"></i> |