Skip to content

Instantly share code, notes, and snippets.

@morimori
morimori / gist:3688802
Created September 10, 2012 03:59
focus タグや save_and_open_page が残っていたらコミットさせない pre-commit フック
# Block commit include focus tag for test
git stash --keep-index -q
FOCUS_TAGS=$(grep -rn ':focus => true' spec/*/**)
result=$?
git stash pop -q
if [ $result -eq 0 ]; then
echo "### PLEASE REMOVE FOCUS TAGS ###"
echo "$FOCUS_TAGS"
exit 1
fi
@fnichol
fnichol / README.md
Created February 26, 2012 01:23
A Common .ruby-version File For Ruby Projects

A Common .ruby-version File For Ruby Projects

Background

I've been using this technique in most of my Ruby projects lately where Ruby versions are required:

  • Create .rbenv-version containing the target Ruby using a definition name defined in ruby-build (example below). These strings are a proper subset of RVM Ruby string names so far...
  • Create .rvmrc (with rvm --create --rvmrc "1.9.3@myapp") and edit the environment_id= line to fetch the Ruby version from .rbenv-version (example below).

Today I learned about another Ruby manager, rbfu, where the author is using a similar technique with .rbfu-version.

@jrom
jrom / nginx.conf
Created February 7, 2012 17:14
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
@rstacruz
rstacruz / index.md
Last active November 3, 2023 09:56
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one