Skip to content

Instantly share code, notes, and snippets.

@forabi
Created September 26, 2014 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save forabi/85c1b8f92753878c9645 to your computer and use it in GitHub Desktop.
Save forabi/85c1b8f92753878c9645 to your computer and use it in GitHub Desktop.
Statistics for Node/CoffeeScript projects
#!/bin/bash
function get_file_names {
find -type f |
egrep -v '/(node_modules)|(.git)/' | # Ignore node_modules and .git
egrep -v '^./(tmp|posts|dist)/' | # Ignored dirs
egrep -v '.(swp|ttf|txt|css|woff|eot|svg|png|jpe?g|sublime-.*)$' # Ignored file types
}
function get_loc {
cat "$@" | wc -l
}
files=$(get_file_names);
echo Number of files: $(echo $files | wc -w)
echo Lines of code: $(get_loc $files)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment