Instantly share code, notes, and snippets.

Craig Rowe cargowire

View GitHub Profile

Keybase proof

I hereby claim:

  • I am cargowire on github.
  • I am cargowire ( on keybase.
  • I have a public key ASAtuFVcugGTK_Xzq_FHZJbsosuh-R7mRRgNnr6RxdLVWAo

To claim this, I am signing this object:

for i in *.$1;
IFS="." read -ra parts <<< "$i"
mv $i ${parts[0]:0:$3}$2.${parts[1]};
unset IFS
# Uses php cli to run all php files in the current directory and write their output to file
# Argument 1 is the extension of the output files e.g. ".html" or ".htm"
# Argument 2 is a prefix for the filenames
for file in *.php; do
php $file | cat > $2${file%.php}$1;
# Simple find unreferenced filename script
# Argument 1 is a folder that contains files you are interested in. e.g. an images folder
# Argument 2 is a folder that contains the files to search within. e.g. a css folder
for pattern in `ls $1`; do
if ! grep -rq $pattern $2; then
echo $pattern;
View namespacedAutoOnLoad.js
// Single jquery onload action covers all namespaced items
$(function () { traverse(myNamespace); });
// Identify all _load methods in the namespace and call them within their own object scope
var traverse = function(jsonObj, parentObj, name) {
if (typeof (jsonObj) == "object") {
parentObj = jsonObj;
$.each(jsonObj, function(k,v) {
traverse(v, parentObj, k);