This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//in reply to http://twitter.com/#!/scott_gonzalez/status/74191962739183616 | |
//http://bit.ly/jpf1mB | |
var s = document.getElementsByTagName('select')[0]; | |
s.style.height = "auto"; | |
s.style.height = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Fill in the blanks :) | |
var map = new google.maps.Map(), | |
tileListener = google.maps.event.addListener(map,'tilesloaded',fixMyPageOnce); | |
function fixMyPageOnce(){ | |
//immediately remove the listener (or this thing fires for every tile that gets loaded, which is a lot when you start to pan) | |
google.maps.event.removeListener(tileListener); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
"string" == 0; //true | |
"string" === 0; //false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(defined('className::CONSTANT_NAME')){ | |
//defined | |
}else{ | |
//not defined | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo `</dev/urandom tr -dc A-Za-z0-9 | head -c8` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @param string $uniqID - Anything that would be unique to what you are caching (url/database query) | |
* @param integer $expireSeconds - How old is too old that we refresh the cache | |
*/ | |
function _getFromCache($uniqID,$expireSeconds){ | |
$uniq = '/<path to your cache storage folder>/'.md5($uniqID); | |
if(file_exists($uniq) && time() - filemtime($uniq) <= $expireSeconds){ | |
return '<process cached file>($uniq)'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Example of how to include an if conditional in a where clause | |
-- We only want rows where a = 1 or 2 but only a = 2 if b = 4 | |
-- table structure: | |
-- [ a | b ] | |
-- 1 4 | |
-- 2 4 | |
-- 1 5 | |
-- 3 9 | |
-- 2 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Usage: | |
* $answer = prompt("What is your quest?"); | |
* echo "Answer: $answer"; | |
* | |
* Outputs: | |
* What is your quest? | |
* I seek the holy grail! | |
* Answer: I seek the holy grail! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# varaible is 'Hello There' #} | |
{{ variable|url_encode() }} {# Hello+There #} | |
{# If you want to use rawurlencode what do you do? #} | |
{{ variable|url_encode(true) }} {# Hello%20There #} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# | |
time can be any string acceptable by http://www.php.net/strtotime, the | |
template will output that time's month. | |
If you don't want to pass in a date you can set time like this: | |
{% set time = "now"|date("U") %} | |
{% set time = "December 2012"|date("U") %} | |
How ever you want to output items onto the calendar is a different issue, | |
but I'd assume pushing everything into an array numerically indexed by that day: |
OlderNewer