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
// Author: Darren Schnare | |
// Keywords: aop,aspect,oriented,programming,javascript,pointcut | |
// License: MIT ( http://www.opensource.org/licenses/mit-license.php ) | |
// Repo: https://gist.github.com/1235559 | |
// Inspiration: http://karlagius.com/2008/04/25/aspect-oriented-programming-in-javascript/ | |
// Reference: http://docs.jboss.org/jbossaop/docs/2.0.0.GA/docs/aspect-framework/reference/en/html/advices.html | |
// Reference: http://static.springsource.org/spring/docs/2.0.x/reference/aop.html | |
// Appends the aop namespace to the specified scope (defaults to global). |
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
// Author: Darren Schnare | |
// Keywords: javascript,equality,testing,equals,object | |
// License: MIT ( http://www.opensource.org/licenses/mit-license.php ) | |
// Repo: https://gist.github.com/1251001 | |
// Creates an equals function within the specified scope. | |
(function(scope) { | |
// Determines if two objects have the same values. This is a | |
// recursive test that tests all objects through out the object | |
// tree. |
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
// Author: Darren Schnare | |
// Keywords: javascript,interpolation,string,ruby | |
// License: MIT ( http://www.opensource.org/licenses/mit-license.php ) | |
// Repo: https://gist.github.com/gists/3886395 | |
String.prototype.interpolate = function (o) { | |
return this.replace(/#\{(.+?)\}/g, function ($0, $1) { | |
with (o) { | |
return eval($1); | |
} | |
}); |
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
extends layout | |
prepend page | |
- title = "Home" | |
block body | |
p This is the \#{title} page |
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
// jQuery Validate setup. | |
$('form').validate({ | |
rules: { | |
"cover-letter": { | |
required: true, | |
accept: "application/pdf|application/msword|application/vnd.openxmlformats-officedocument.wordprocessingml.document" | |
} | |
}, | |
messages: { | |
"cover-letter": "Please upload your cover letter (PDF, DOC or DOCX)." |
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
// Create our stage canvas. | |
var stage = document.createElement('canvas'); | |
stage.style.border = '1px solid #000'; | |
document.body.appendChild(stage); | |
// Create offscreen buffer for our text rendering. | |
// This way all we have to do is draw our buffer to | |
// the main canvas rather than drawing text each frame. | |
var textBuffer = document.createElement('canvas'); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>TITLE</title> | |
<style type="text/css"> | |
html, | |
body { | |
margin: 0; | |
} | |
.viewport { |
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
// Augment the Bootstrap Carousel jQuery plugin so that .item.active | |
// queries use a direct descendent selector to find the active item. | |
// With this patch you can now arbitrarily nest carousels inside | |
// the .item elements of other carousels. | |
$.fn.carousel = (function (carousel) { | |
return function () { | |
var $carousel = carousel.apply(this, arguments); | |
var c = $carousel.data("bs.carousel"); | |
if (!c.$element.find.__overridden) { | |
// If the plugin changes from using $element.find(".item.active") |
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
/** | |
* Collates all properties with varying values or the specified properties in | |
* the property map into a single object. | |
* | |
* If the propMap is an Object then the keys are the properties to collate and | |
* the values are the target property name to created on the collated object. If | |
* the key in the propMap is a comma delimited string then the target property | |
* will be set to an object with all the properties in the comma delimited | |
* key. | |
* |
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
/** | |
* Business Object class object that acts as the root of an object hierarchy. | |
* Creates object instances that have methods marked as read-only and the object | |
* sealed, meaning no new properties can be added and behaviour cannot be changed | |
* without extending the class object (i.e. tamperproof). | |
* | |
* @example | |
* const Box = BObject.subClass({ | |
* className: 'Box', | |
* new ($base, width, height) { |
OlderNewer