Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Safari <label> fix

if (navigator.userAgent.indexOf('Safari') != -1) {
	window.addEventListener('load', function() {
		var lock = false;
		var labels = document.getElementsByTagName('label');
		for (var i = 0; i < labels.length; i++)
			labels[i].addEventListener('click', function() {
				var input = (this.htmlFor ? document.getElementById(this.htmlFor) : this.getElementsByTagName('input')[0]);
				if (input && !lock) {
					input.focus();
					lock = true;
					input.click();
					lock = false;
				}
			});
	});
}

How to update something using a patch (Wordpress, pmwiki etc.)

After unzipping, taring or whatever archive you used copy thepatch over the old files, replacing them.

Copy the files in your newly extracted directory (pmwik-new/wordpress-patch) over the files of your existing software installation. For example, if your existing PmWiki/Wordpress installation is in a directory called pmwiki/wordpress, then one way to copy the new files over the existing ones is to enter the command:
cp -a pmwiki-new/. pmwiki


Note that BSD systems will not have the -a option as a command-line argument for cp, but that's okay, since it's just shorthand for cp -dpR, so use that instead of -a.

On (some) FreeBSD servers and Mac OS X systems you need to use
cp -Rpv pmwiki-new/. pmwiki 

This works well on TxD shared hosting.