Randomly sort an array using PHP’s shuffle() function

If you ever need to randomise a PHP array, and want to do it in one line, use the shuffle() function. It’s especially useful when you just want to draw one array member randomly, like in a lottery or something.

$values = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); 
shuffle($values); //randomise the array members
echo array_pop($values); //outputs a random number from $values

MySQL timestamp syntax quick reference

Quick code post with a really useful little function, all it does it return a MySQL timestamp value of ‘now’. It’s useful if you haven’t already committed the format to memory, which sadly I have already… but still, it’s good to have in a common function library.

function mysqlnow() {
    return date("Y-m-d H:i:s");
}

 

Make shortlists of your Github Issues with GitSprint

Built this last weekend as a side project to help with one of my bigger projects, it will allow you to log in with GitHub and build yourself a nice little shortlist (“Sprint” in AGILE/SCRUM terms) of tasks. It’s basically a TODO list you can quickly build based on your GitHub Issues.

Core functionality is there but I will be adding a few little bits and pieces to make it prettier and more functional.

http://www.gitsprint.com/

Enjoy!