named_scope
in 2.x.
named_scope :active, :conditions => { :status => "activo" }
Just scope
now.
scope :active, where( :status => "activo" )
#!/bin/bash | |
### Copyright 2009 Ian Young | |
### Available under the terms of the MIT license | |
### ABOUT | |
### Prevents you from svn switching to a mismatched directory in a different branch. | |
### See http://blog.iangreenleaf.com/2009/11/avoiding-disaster-when-using-svn-switch.html | |
### USAGE |
#!/bin/bash | |
### ABOUT | |
### Runs rsync, retrying on errors up to a maximum number of tries. | |
### Simply edit the rsync line in the script to whatever parameters you need. | |
# Trap interrupts and exit instead of continuing the loop | |
trap "echo Exited!; exit;" SIGINT SIGTERM | |
MAX_RETRIES=50 |
function error_message { | |
echo -e >&2 \ | |
"---------------------------------------------------------------------------------------------------------" \ | |
"\n$1" \ | |
"\n---------------------------------------------------------------------------------------------------------" | |
} | |
function undo_merge { | |
error_message "Undoing your merge. Please fix the problem and try again." |
# Usage: reload-db /path/to/sqldump dbname | |
function reload-db { | |
for f in "$1"/*.sql; do | |
printf "%-${COLUMNS}s" "$f">&2; | |
cat "$f"; | |
done \ | |
| pv -s `du -sb "$1" | awk '{print $1}'` \ | |
| mysql -uroot "$2"; | |
if [ $? != 0 ]; then echo 'ERRORS!!!!!!!!!!!!!'; return $?; fi |
;; Semicolons are comments | |
> (+ 2 4) | |
6 | |
> (+ 2 4 8) | |
14 | |
> (define double (lambda (a) (+ a a))) | |
> (double 3) | |
6 | |
> '(1 2 3) ; this is a list | |
(1 2 3) |
# Mergesort | |
# precondition: no nils in the array | |
def sort some_array | |
return some_array if some_array.length == 1 | |
half_length = some_array.length / 2 | |
first_half = sort(some_array[0,half_length]) | |
second_half = sort(some_array[half_length, some_array.length - half_length]) | |
result = [] |
[diff "ruby"] | |
wordRegex = (@@?|\\b:|[^:]:)?[[:alnum:]_]+|:\"[^\"]+\"|::|[^[:space:]] | |
[diff "php"] | |
wordRegex = \\${0,2}[[:alnum:]_]+|::|->|[^[:space:]] |
[core] | |
excludesfile = /Users/ian/.gitignore | |
[color] | |
ui = auto | |
[alias] | |
co = checkout | |
st = status | |
br = branch | |
ci = commit | |
m = checkout master |
" Vim indent file | |
" Language: Yaml | |
" Author: Ian Young | |
" Get it bundled for pathogen: https://github.com/avakhov/vim-yaml | |
if exists("b:did_indent") | |
finish | |
endif | |
"runtime! indent/ruby.vim | |
"unlet! b:did_indent |