In PHP, even if the individual items within an array or properties of an object are empty, the array or object will not evaluate to empty using the `empty($subject)` function. In other words, cobbling together a bunch of data that individually tests as "empty" creates a composite that is non-empty.

This is not a code snippet but out of respect for the authors, I won't re-post, just link to their site. These are some really useful one-liners for SED. If you use the *nix command line, you already know how powerful shell scripting is. http://www-rohan.sdsu.edu/doc/sed.html

It is inevitable that there will be situations where you need a CSS rule to target a specific browser. This hack targets Safari and Chrome (webkit browsers) and works with Safari 5.1.2 and Chrome 17.0.963.56 as of March 03, 2012.

In order to improve the load time of my home page, I wanted to show a static HTML page for non-authenticated requests. However, WordPress handles search through the main entry point (index.php). I came up with this conditional Rewrite to handle any request with the ?s=search+term through index.php but let all other requests pass through to my static page.

AdBlock Plus, the popular banner advertisement blocking plugin, leaves huge blank spaces on your web page where your ads are supposed to appear. This simple script detects AdBlock Plus and gracefully degrades your page, hiding the banner ad enclosing elements.

If you are using the Jetpack WordPress plugin, it adds a small smiley image to the bottom of your web page. This image can break your page design. This piece of CSS will make the image virtually invisible without breaking the stats gather functionality.

Checks a string to determine if it is a well-formatted URL (web address).

Regular Expression function to validate email addresses.

A bash routine to create a GZIP tarball of a folder's contents with a single command. The tarball name is created using the folder name and the current time stamp. Just add this function to your bashrc file (usually in /etc/bashrc).

This snippet demonstrates how to execute JavaScript that is returned inside of an Ajax request. This example applies specifically to instances where a Script tag is returned as part of an Ajax response. The typical browser behavior is to not execute the script.