Skip to content

Instantly share code, notes, and snippets.

View webdev's full-sized avatar
💭
Exploring Awesomenesss

George Blazer webdev

💭
Exploring Awesomenesss
  • San Francisco, CA
View GitHub Profile
## Controller
class Program < ActiveRecord::Base
#enum_attr :status, %w(pending live on_hold completed)
#enum_attr :kind, %w(social_video youtube facebook twitter)
has_one :flight, :dependent => :destroy
has_one :creative, :dependent => :destroy
accepts_nested_attributes_for :flight
accepts_nested_attributes_for :creative
set :rails_env, :production
set :unicorn_binary, "/usr/bin/unicorn"
set :unicorn_config, "#{current_path}/config/unicorn.rb"
set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid"
namespace :deploy do
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D"
end
task :stop, :roles => :app, :except => { :no_release => true } do
@webdev
webdev / caveatPatchor.js
Created March 20, 2012 19:23 — forked from timblair/caveatPatchor.js
Sample caveatPatchor.js file for use in Propane 1.1.2 and above: pulls avatars from Gravatar
/*
As of version 1.1.2, Propane will load and execute the contents of
~Library/Application Support/Propane/unsupported/caveatPatchor.js
immediately following the execution of its own enhancer.js file.
You can use this mechanism to add your own customizations to Campfire
in Propane.
Below you'll find two customization examples.
:+1:
:-1:
:airplane:
:art:
:bear:
:beer:
:bike:
:bomb:
:book:
:bulb:
#
# An improvement on http://stackoverflow.com/a/9094206/284612
#
# Place this file in spec/support/signed_cookies.rb
#
module SignedCookies
def signed_cookie(name, opts={})
verifier = ActiveSupport::MessageVerifier.new(request.env["action_dispatch.secret_token".freeze])
if opts[:value]
@request.cookies[name] = verifier.generate(opts[:value])
@webdev
webdev / gist:4690038
Created February 1, 2013 08:03
Install rmagick on MacOSX Mountain Lion
brew update
brew install ImageMagick
cd /usr/local/Cellar/imagemagick/6.8.0-10/lib
ln -s libMagick++-Q16.7.dylib libMagick++.dylib
ln -s libMagickCore-Q16.7.dylib libMagickCore.dylib
ln -s libMagickWand-Q16.7.dylib libMagickWand.dylib
gem install rmagick
Asynchronous AOF fsync is taking too long (disk is busy?). Writing the AOF buffer without waiting for fsync to complete, this may slow down Redis.
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 10/13/2011
####################################
sudo apt-get update
sudo apt-get upgrade
def response(env)
...
notify
end
def notify
env.logger.info "Stream connection opened"
i = 0