Questions? Feedback? powered by Olark live chat software

regex Regular expression to match email

$pattern = ‘/([A-Za-z0-9\.\-\_\!\#\$\%\&\’\*\+\/\=\?\^\`\{\|\}]+)\@([A-Za-z0-9.-_]+)(\.[A-Za-z]{2,5})/’;

Posted in Docs & Training

Moving WordPress

On Your Existing Server Moving the WordPress files from one location on your server to another – i.e. changing its URL – requires some special care. If you want to move WordPress to its own folder, but have it run

Posted in Docs & Training

WordPress to disable plugin update notification

add_filter(‘site_transient_update_plugins’, ‘dd_remove_update_nag’); function dd_remove_update_nag($value) { unset($value->response[ plugin_basename(__FILE__) ]); return $value; }

Posted in Docs & Training

CSS margin shorthand property

The margin property can have from one to four values. margin:25px 50px 75px 100px; top margin is 25px right margin is 50px bottom margin is 75px left margin is 100px margin:25px 50px 75px; top margin is 25px right and left

Posted in Docs & Training

CSS to make a parent div auto size to the width of its children divs

Using display:inline-block instead of width:auto on the container div.

Posted in Docs & Training

Find and replace in multiple files

To find and replace in multiple files on Unix command line use this: find . -name ‘*.html’ |xargs perl -pi -e ‘s/find/replace/g’

Posted in Docs & Training

Responsive CSS

@media all and (min-width: 50px) { body { font-size:0.1em; } } @media all and (min-width: 100px) { body { font-size:0.2em; } } @media all and (min-width: 200px) { body { font-size:0.4em; } } @media all and (min-width: 300px) { body

Posted in Docs & Training

Reset AUTO_INCREMENT in MySQL

ALTER TABLE tablename AUTO_INCREMENT = 1

Posted in Docs & Training

Sort Multi-dimensional Array by Value

This php function sorts a multi-dimensional array by value. function aasort (&$array, $key) { $sorter=array(); $ret=array(); reset($array); foreach ($array as $ii => $va) { $sorter[$ii]=$va[$key]; } asort($sorter); foreach ($sorter as $ii => $va) { $ret[$ii]=$array[$ii]; } $array=$ret; }

Posted in Docs & Training

Lorem ipsum

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor

Posted in Docs & Training