wilson (owner)

Fork Of

gist: 227361 by defunkt Reduce your carbon footprint

Revisions

gist: 227416 Download_button fork
public
Description:
use ruby instead of perl
Public Clone URL: git://gist.github.com/227416.git
Embed All Files: show embed
carbon.md #

Vim

autocmd BufWritePre * :%s/\s\+$//e

Emacs

(add-hook 'before-save-hook 'delete-trailing-whitespace)

Textmate

http://blogobaggins.com/2009/03/31/waging-war-on-whitespace.html

In your existing codebase

find . -name '*.rb' | xargs ruby -pi -e 'sub!(/\s+$/, "\n")'

Rake task for a Rails app

desc "Remove unnecessary whitespace" task :whitespace do sh %Q{find app lib spec -name '.rb' -or -name '.haml' | xargs ruby -pi -e 'sub!(/\s+$/,"\n")'} end