Craig Rowe cargowire

View addsuffix.sh
1 2 3 4 5 6
for i in *.$1;
do
IFS="." read -ra parts <<< "$i"
mv $i ${parts[0]:0:$3}$2.${parts[1]};
unset IFS
done
View convertphp.sh
1 2 3 4 5 6 7
# 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;
done
View unreferencedfiles.sh
1 2 3 4 5 6 7 8 9
# 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;
fi
done
View namespacedAutoOnLoad.js
1 2 3 4 5 6 7 8 9 10
// 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);
});
Something went wrong with that request. Please try again.