PHP Date() Cheat Sheet
March 25th, 2009Just finished a cheat sheet for the PHP Date() function. I can never remember any of the identifiers. Hope someone finds it useful!
Click here to download .PDF (250 Kb)
This Cheat Sheet is released under a Creative Commons License (Attribution, Non-Commercial, Share Alike).
PHP Power Set
January 22nd, 2009Here is a snippet that shows how to get the power set of an array.
/**
* Takes the power set of a one dimensional array and returns a 2-D array.
* array(a,b,c) ->
* array(array(a),array(b),array(c),array(a,b),array(b,c),array(a,b,c))
*/
function powerSet($in,$minimumNumber = 1) {
$count = count($in);
$members = pow(2,$count);
$return = array();
for ($i = 0; $i < $members; $i++) {
$b = sprintf("%0".$count."b",$i);
$out = array();
for ($j = 0; $j < $count; $j++) {
if ($b{$j} == '1') $out[] = $in[$j];
}
if (count($out) >= $minimumNumber) {
$return[] = $out;
}
}
return $return;
}
Which browsers load images that have display:none or visibility:hidden?
January 15th, 2009Turns out all of them, with the sole exception of Opera 9, and only for display:none. It looks like Opera is the only browser that cares about the speed of the browsing experience.
browsers tested: IE 7, IE 6, FF 3.0, Safari, Chrome and Opera 9.
Test Page: http://janitor61.com/test/test.html
openallbrowsers.bat
January 7th, 2009Here’s a Windows Batch file that will let you open a specific web page in all browsers. Look through it and comment out the browsers you don’t have installed.
@echo off echo --------------------------- echo -- Open in all browsers -- echo --------------------------- :enter echo Enter the URL: set /p answer=URL: echo Use "%answer%"? set /p use=[Y/N]: if /i "%use:~,1%" EQU "N" goto enter REM == Opera == start "" "%programfiles%\Opera\opera.exe" "%answer%" REM == Firefox == start "" "%programfiles%\Mozilla Firefox\firefox.exe" "%answer%" REM == Safari == start "" "%programfiles%\Safari\Safari.exe" "%answer%" REM == Internet Explorer == start "" "%programfiles%\Internet Explorer\iexplore.exe" "%answer%" REM == MultipleIE (only if you have this installed) == start "" "%programfiles%\MultipleIEs\IE6\iexplore.exe" "%answer%" REM == Chrome == start "" "%USERPROFILE%\Local Settings\Application Data\Google\Chrome\Application\chrome.exe" "%answer%"
What the SWF
November 26th, 2008New SWF Properties application - What the SWF.

