Test CSS media queries

We're working more and more with media queries at Snowfire, so we've created this tool that let's you test and explore different queries and viewport settings.

PHP escapeshellarg with unicode/utf-8 support

By default escapeshellarg will strip any unicode characters. You can in some cases solve this by setting the locale to a utf-8 variant, but that might not always work.

Another way to do this is to write a custom escapeshellarg function:

function mb_escapeshellarg($arg)
{
	if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
		return '"' . str_replace(array('"', '%'), array('', ''), $arg) . '"';
	} else {
		return "'" . str_replace("'", "'\\''", $arg) . "'";
	}
}

The code above is translated from the C source of PHP.

Install a locale on Ubuntu 11.10

To see what locales are installed, run

locale -a

To see what locales are available for installation, run

less /usr/share/i18n/SUPPORTED

To install the en_GB locale, run

locale-gen en_GB

Tip: Leave out the charset and every charset will be installed for that locale.

Change time zone on Ubuntu 11.10 from command line

It's actually very easy.

dpkg-reconfigure tzdata

Just run that and select where you live. Verify that the time is correct with the date command.

Get back missing Photoshop from Adobe Bridge CS5.1

Today when I had finished post-processing some photos, I noticed that the Photoshop sub-menu had disappeared from the Tools menu. After searching the Interwebs and my computer, I found a solution.