View example.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ FOO=1234 | |
$ echo ${FOO} ${BAR} | |
> 1234 | |
$ echo ${FOO:-555} ${BAR:-666} | |
> 1234 666 |
View gist:2406384
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Requirements: | |
- multiple file uploads at the same time (or at least queued) | |
- compatible with IE8+, Firefox 3.6+, Chrome 5+, Safari 4+ | |
Nice to haves: | |
- individual and/or global progress bar | |
- drag & drop | |
- no flash necessary | |
Existing solutions (any comments? any other recommendations?): |
View gist:1078666
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ruby 1.9 Fast require: | |
# https://gist.github.com/1008945 | |
curl https://raw.github.com/gist/1008945/7532898172cd9f03b4c0d0db145bc2440dcbb2f6/load.patch > load.patch | |
# Ruby 1.9.2 GC Patch: | |
# https://gist.github.com/856296 | |
curl https://raw.github.com/gist/856296/a19ac26fe7412ef398bd9f57e61f06fef1f186fe/patch-1.9.2-gc.patch > gc.patch | |
rvm install 1.9.2-p180 --patch load.patch,gc.patch -n loadgc | |
rm gc.patch load.patch |
View .bashrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ -x /usr/libexec/path_helper ]; then | |
eval `/usr/libexec/path_helper -s` | |
fi | |
eval `/usr/libexec/path_helper -s` | |
source ~/.bash_profile | |
cd . |
View gist:243509
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mongo_template.rb | |
# remove unneeded defaults | |
run "rm public/index.html" | |
run "rm public/images/rails.png" | |
run "rm public/javascripts/controls.js" | |
run "rm public/javascripts/dragdrop.js" | |
run "rm public/javascripts/effects.js" | |
run "rm public/javascripts/prototype.js" |
View gist:162775
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# modificado a partir de http://github.com/relevance/etc/raw/26ae85c2f6c7d2640a3c75d619ad7ab8fc1cc570/bash/ruby_switcher.sh | |
# (ver http://blog.thinkrelevance.com/2009/7/29/ruby-switcher-working-with-multiple-ruby-versions-has-never-been-this-easy) | |
# | |
# modificado para usar o ruby nativo do ubuntu (9.04) como default | |
# permite alternar entre os rubys todos E o ruby nativo do ubuntu | |
# | |
# modificações (ao final do arquivo somente): | |
# * inclusão da função 'use_native_ruby' | |
# * comentário da linha que ativa o ruby nativo do leopard por padrão | |
# * inclusão de linha que ativa o ruby nativo do ubuntu por padrão |
View gist:161521
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Image < ActiveRecord::Base | |
COMMON_ATTACHMENT_OPTIONS = { | |
:content_type => :image, | |
:max_size => 1.megabyte, | |
:thumbnails => { | |
:thumbnail => "75x75!", | |
:small => "100x", | |
:medium => "240x", | |
:large => "500x", | |
} |
View gist:161515
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TempImage < Image | |
has_attachment({ | |
:storage => :file_system, | |
:path_prefix => "public/uploads/#{table_name}", | |
}.merge(COMMON_ATTACHMENT_OPTIONS) | |
) | |
after_create :queue_move_to_s3 | |
def move_to_s3 |