autocmd BufWritePre * :%s/\s\+$//e
(add-hook 'before-save-hook 'delete-trailing-whitespace)
| before "deploy:rollback:revision", "deploy:rollback_database" | |
| desc "Rolls back database to migration level of the previously deployed release" | |
| task :rollback_database, :roles => :db, :only => { :primary => true } do | |
| if releases.length < 2 | |
| abort "could not rollback the code because there is no prior release" | |
| else | |
| rake = fetch(:rake, "rake") | |
| rails_env = fetch(:rails_env, "production") | |
| migrate_env = fetch(:migrate_env, "") |
| # Author: Michael van Rooijen | |
| # Description: | |
| # This recipe is designed to work for people using Phusion Passenger, | |
| # Git as your repository. | |
| # | |
| # The script (initially) does the following: | |
| # - It first (after you run cap:deploy setup) will set up the capistrano environment on your remote machine | |
| # - After that, it will sync your current database.yml file to the "shared" location on the remote machine | |
| # - You are now basically ready to deploy. | |
| # - Once you run "cap:deploy" it will start the deployment |
| Factory.define :account_with_users do |ac| | |
| ac.sequence(:name) { |n| "Account#{n}" } | |
| ac.sequence(:subdomain) { |n| "subdomain#{n}" } | |
| ac.after_build do |account| | |
| account.users = [Factory.build(:user),Factory.build(:user)] | |
| end | |
| end | |
| Factory.define :user do |u| | |
| u.sequence(:name) { |n| "John Doe #{n}" } |
| # Throw this into your bash init file for automatic | |
| # paging of a few svn commands, a la git. | |
| SVN_PATH=`which svn` | |
| function svn | |
| { | |
| case $1 in | |
| cat | diff | help | list | log ) | |
| if test -t 1 | |
| then |
| module Rack | |
| class NoIE | |
| def initialize(app, options = {}) | |
| @app = app | |
| @options = options | |
| @options[:redirect] ||= 'http://www.microsoft.com/windows/internet-explorer/default.aspx' | |
| @options[:minimum] ||= 7.0 | |
| end | |
| def call(env) |
| class MessageMailer < Merb::MailController | |
| include DataMapper::Validate | |
| extend DataMapper::Validate::ClassMethods | |
| def attribute_get(sym); @params[sym] end | |
| def attribute_set(sym, val); @params[sym] = val end | |
| [:from].each { |s| | |
| class_eval " | |
| def #{s}; attribute_get(:#{s}) end |
| source :gemcutter | |
| gem 'rails', '~> 2.3.5', :require => nil |
| class MyMiddleware | |
| def self.call(env) | |
| new({:a => 'b'}).call(env) | |
| end | |
| def initialize(config) | |
| @config = config | |
| end | |
| def call(env) |
| #flash | |
| - flash.each do |key, value| | |
| %div{:class => key, :id => "flash_#{key}"}= value | |
| :javascript | |
| Event.observe(window, 'load', function() { | |
| Effect.Fade('flash_#{key}', { duration: 3.0 }); | |
| }); |