Questions? Feedback? powered by Olark live chat software
Monthly Archives: April 2014

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