Skip to content

Instantly share code, notes, and snippets.

@unicornrainbow
Created January 27, 2011 16:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unicornrainbow/798713 to your computer and use it in GitHub Desktop.
Save unicornrainbow/798713 to your computer and use it in GitHub Desktop.
A shell function to auto remove whitespace from an entire rails project in one shot.
remove_project_trailing_whitespace () {
for file in * (app|config|test|lib|public)/**/*.(rb|js|sass|css|yml|md|txt|erb|haml|config)
do
sed -i "" 's/[[:space:]]*$//' ${file}
sed -i "" -e :a -e '/^\n*$/N;/\n$/ba' ${file}
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment