Skip to content

Instantly share code, notes, and snippets.

@zachstronaut
zachstronaut / gist:1184900
Created Aug 31, 2011
Stretch HTML5 canvas to fill window, preserving aspect ratio
View gist:1184900
/**
* fullscreenify()
* Stretch canvas to size of window.
*
* Zachary Johnson
* http://www.zachstronaut.com/
*
* See also: https://gist.github.com/1178522
*/
@zachstronaut
zachstronaut / gist:1184831
Created Aug 31, 2011
Get a relative time string in PHP without a lot of if/else or switch/case
View gist:1184831
<?php
/**
* time_elapsed_string()
*
* Zachary Johnson
* http://www.zachstronaut.com/posts/2009/01/20/php-relative-date-time-string.html
*/
function time_elapsed_string($ptime) {
$etime = time() - $ptime;