Skip to content

Instantly share code, notes, and snippets.

@codesnik
Created February 5, 2010 01:14
Show Gist options
  • Save codesnik/295361 to your computer and use it in GitHub Desktop.
Save codesnik/295361 to your computer and use it in GitHub Desktop.
convert before commit
#!/usr/bin/env zsh
# convert to utf8,
# remove unneccessary utf8 BOM
# add new line at end of file if omitted
# change line terminators to cr from crlf
for f in public/**/*.{css,js,html,htm}; do
mv $f $f.orig
cat $f.orig | \
enconv -x utf8 | \
perl -CSDA -lpe 'tr/\x{feff}\r//d' > $f
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment