Skip to content

Instantly share code, notes, and snippets.

View webmat's full-sized avatar

Mathieu Martin webmat

View GitHub Profile
after "deploy:stop", "delayed_job:stop"
after "deploy:start", "delayed_job:start"
after "deploy:restart", "delayed_job:restart"
namespace :delayed_job do
desc "Stop the delayed_job process"
task :stop, :roles => :app do
run "cd #{current_path}; script/delayed_job -e #{rails_env} stop"
end
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
@webmat
webmat / hash_to_s.rb
Created September 13, 2011 18:49
Better Ruby Hash#to_s
# Let's face it. Ruby's Hash#to_s output isn't very useful.
# Here's a draft for a better version.
class Hash
def to_s
keys.inject([]) do |a, key|
a << "#{key}: #{fetch(key)}"
end.join(', ')
end
end
@neilj
neilj / gist:1532562
Created December 29, 2011 07:22
Sugared DOM: Better Than Templates
var el = ( function () {
var doc = document;
var directProperties = {
'class': 'className',
className: 'className',
defaultValue: 'defaultValue',
'for': 'htmlFor',
html: 'innerHTML',
@threetee
threetee / unicorn_wrapper.sh
Created January 20, 2012 19:52
Wrapper to allow runit to send signals to the unicorn master even when its PID changes
#!/bin/sh
set -e
APP=$1
APP_PATH="/srv/${APP}/current"
RAILS_ENV=$2
UNICORN_CONFIG="/etc/unicorn/${APP}.rb"
UNICORN_PID_FILE="/tmp/unicorn.${APP}.pid"
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@peternixey
peternixey / securing_rails_updates.md
Created March 5, 2012 13:10
How Homakov hacked GitHub and how to protect your application by Peter Nixey

##How Homakov hacked GitHub and the line of code that could have prevented it


Please note: THIS ARTICLE IS NOT WRITTEN BY THE GITHUB TEAM or in any way associated with them. It's simply hosted as a Gist because the markdown formatting is excellent and far clearer than anything I could manage on my personal Tumblr at peternixey.com.

If you'd like to follow me on twitter my handle is @peternixey


@karmi
karmi / .gitignore
Created March 16, 2012 16:09
Bootstrap, install and configure ElasticSearch with Chef Solo
.DS_Store
Gemfile.lock
*.pem
node.json
tmp/*
!tmp/.gitignore
@coreyhaines
coreyhaines / .rspec
Last active April 11, 2024 00:19
Active Record Spec Helper - Loading just active record
--colour
-I app
@ifandelse
ifandelse / amplify.js
Created March 20, 2012 16:34
amplify.js in an AMD Wrapper
/*!
* AmplifyJS 1.0.0 - Core, Store, Request
*
* Copyright 2011 appendTo LLC. (http://appendto.com/team)
* Dual licensed under the MIT or GPL licenses.
* http://appendto.com/open-source-licenses
*
* http://amplifyjs.com
*/
(function(root, doc, factory) {