How to detect Retina display in CSS

@media only screen and (-webkit-min-device-pixel-ratio: 2),(min-resolution: 192dpi) {
  /* it's retina yeah! */

Toggle Hidden Files in Finder

Run Automator and create new Application. Add task Run Shell script and paste follow code:

STATUS=`defaults read AppleShowAllFiles`
if [ $STATUS == YES ];
    defaults write AppleShowAllFiles NO
    defaults write AppleShowAllFiles YES
killall Finder

Save application. From now can Tooggle

List all mounted drives on mac

It's simple: df -h

Wodpress constants for human-readable intervals

Constants for expressing human-readable intervals in new #Wordpress are very useful:

define( 'MINUTE_IN_SECONDS', 60 );
define( 'DAY_IN_SECONDS',    24 * HOUR_IN_SECONDS   );
define( 'WEEK_IN_SECONDS',    7 * DAY_IN_SECONDS    );
define( 'YEAR_IN_SECONDS',  365 * DAY_IN_SECONDS    );


wp_cache_add($key, $data, 'default, 5 * DAY_IN_SECONDS);

Make WordPress globals more accessible

Wordpress using a lot globals variables. These variables are used throughout WordPress code for various reasons. Great example is database connection object wpdb. Here is common example how to use wpdb in some function:

function something() {
  global $wpdb;
  /** @var wpdb $wpdb */

It's highly uncomfortable and long! Therefore, I have prepared a simple object which make all global variables much more accesible from anywhere: (PHP 5.3+ only)

function something() {