Recursively remove .DS_Store files

If your working on a coding project and your submitting it to version control, heres how to remove the meta-schmeg that OS X leaves around:

find . -name '*.DS_Store' -type f -delete

If your using GIT as your versioning control system then I’d suggest making a .gitignore file in the root of the project after running this command and before you git init to save yourself some bother.

handy Javascript debugging function

Actually taken from the JS v1.4 Guide and modified to be a little more useful:

function showme(obj, obj_name) {
   var result = ""
   var null_list = "";
   obj_name = (obj_name != '')? obj_name: 'obj';
   for (var i in obj) {
		if(obj[i] != null && obj[i] != '')
			result += obj_name + "." + i + " = " + obj[i] + "\n";
		else
			null_list += i + ", ";
   }
   return result + "\n NULL propertys: \n" + null_list;
}

Pass it an object you want to see the properties of and it will show them to you. Like so:

alert(showme(item[i]));

Regular Expression to remove HTML tables

Just figured out this regular expression to remove all tables from a HTML document:

</?table[^>]*>|</?tr[^>]*>|</?td[^>]*>|</?thead[^>]*>|</?tbody[^>]*>

Extremely useful for cleaning up prehistoric mark-up with a text editor that supports regular expression find-and-replace searches.

And to go all the way, this one removes font tags too:

</?table[^>]*>|</?tr[^>]*>|</?td[^>]*>|</?thead[^>]*>|</?tbody[^>]*>|</?font[^>]*>