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
var MyObject = { | |
invokeMethod: function(method, args) { | |
if (typeof MyObject[method] == "function") { | |
MyObject[method](args); | |
} else { | |
throw new TypeError("MyObject has no function "+method); | |
} | |
}, | |
someMethod: function(args) { |
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 | |
/** | |
@see http://www.php.net/manual/en/datetime.createfromformat.php for clarification as to what 'Y-m-d' | |
should be and what we'd expect this to return | |
*/ | |
$date = DateTime::createFromFormat("Y-m-d", "10-01-01"); | |
if ($date !== false) { | |
echo "PHP is mildly retarded"; | |
} else { |
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
/** | |
* Determine whether the supplied value's datatype is Number | |
* @param {Mixed} value Could be a true number: 123, 12.00, or eg: "123", "12.00" | |
* @return {Boolean} Whether value's type is Number, eg: "123" would be false whereas 123 would be true. | |
*/ | |
function isNumber(data) | |
{ | |
var num = parseFloat(data); | |
return ! isNaN(parseFloat(data)) && num.toString() === data.toString(); | |
} |
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
event-proxy.js | |
groupable-model.js | |
test.html |
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
$("form :input").each(function(index, elem) { | |
var eId = $(elem).attr("id"); | |
var label = null; | |
if (eId && (label = $(elem).parents("form").find("label[for="+eId+"]")).length == 1) { | |
$(elem).attr("placeholder", $(label).html()); | |
$(label).remove(); | |
} | |
}); |
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
<script> | |
$(function() { | |
// let's make a bespoke handler for a keypress, so we can potentially | |
// do something like animate the A or whatever | |
$("li.prev a, li.next a").bind('keynav', function(e) { | |
// $(this) is the A element at this point | |
// for now, just go to the href, but we could do more fun stuff here | |
window.location = $(this).attr("href"); | |
}); |
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 | |
class People extends Table { | |
protected $meta = array( | |
'columns' => array( | |
'forename' => array( | |
'type' => 'text', | |
'required' => true, | |
), | |
'surname' => array( | |
'type' => 'text', |
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 | |
PathManager::loadPaths( | |
array("/about", "about") | |
); |
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 | |
class StaticController extends Controller { | |
public function about() { | |
// any controller logic would take place here | |
$title = "Hello About Page!"; | |
// assign the value of $title to the view, where it will be accessible as $pageTitle | |
$this->assign("pageTitle", $title); | |
} |
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
<h1>{$pageTitle}</h1> | |
<p>This is my first application page!</p> |
OlderNewer