Skip to content

Instantly share code, notes, and snippets.

View maxschulze's full-sized avatar

maxschulze maxschulze

View GitHub Profile
@maxschulze
maxschulze / photo.rb
Created November 30, 2010 11:21 — forked from lawitschka/photo.rb
Save image size for paperclip photo
class Photo < ActiveRecord::Base
has_attached_file :image, :styles => { :thumb => ['150x150#', :png],
:normal => ['660x660', :png] },
:default_style => :normal
typed_serialize :sizes, Hash
before_save :cache_image_sizes
# Get size of this photo for specified style
#
@maxschulze
maxschulze / database_cleaner_config.rb
Created November 5, 2010 17:42
Database Cleaner configuration fuer cucumber mit I18n Backend Database
DatabaseCleaner.strategy = :truncation, { :except => %w[ translations ] }
@thbar
thbar / deploy.rb
Created September 7, 2010 18:18
Resque + god + capistrano recipe
# note - you may need to split into a before-deploy (stop) and after-deploy (start) depending on your setup
desc "Hot-reload God configuration for the Resque worker"
deploy.task :reload_god_config do
sudo "god stop resque"
sudo "god load #{File.join deploy_to, 'current', 'config', 'resque.god'}"
sudo "god start resque"
end
after 'deploy:update_code', 'deploy:update_shared_symlinks'