Skip to content

Instantly share code, notes, and snippets.

@mudge
mudge / alternate_method_controller.rb
Created March 9, 2012 17:31
Are filters abused in Rails?
class MyController < ApplicationController
def show
@model = load_model
end
def edit
@model = load_model
end
private
@koenongena
koenongena / gist:1891942
Created February 23, 2012 09:37
git config http.postBuffer 524288000
git config http.postBuffer 524288000
@jasonrudolph
jasonrudolph / git-branches-by-commit-date.sh
Created February 12, 2012 20:40
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@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.

@sorah
sorah / thin
Created November 30, 2011 16:52
/etc/init.d/thin - thin init script with bundle exec. own your risk - public domain.
#!/bin/bash
DAEMON=/path/to/thin
BUNDLE=/path/to/bundle
CONFIG_PATH=/etc/thin
SCRIPT_NAME=/etc/init.d/thin
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
@sumskyi
sumskyi / README.md
Last active June 7, 2022 18:49
rails STI with custom "type" field and storing there value different from ClassName

GeoEntity.last

SELECT geo_entities.* FROM geo_entities ORDER BY geo_entities.id DESC LIMIT 1

returns:

County id: 4, eid: nil, pid: nil, ename: nil, etype: 2, created_at: "2011-11-21 06:26:37", updated_at: "2011-11-21 06:26:37"