Skip to content

Instantly share code, notes, and snippets.

function delegate (child) {
// make it happen
return function inner () {
var self = this;
var func = Object.getOwnPropertyNames(this).filter(function (prop) {
return inner === self[prop];
}).pop();
return this[child][func].apply(this[child], arguments);
@jedireza
jedireza / README.md
Last active February 25, 2016 03:45
ajaxStart and ajaxStop for ampersand-model using the ajaxConfig

Also see the discussion about global ajax settings:

Add support for a global ajaxConfig > Thus far we've just gone for having a base model and base collection in every project.

@jedireza
jedireza / index.js
Created September 18, 2014 19:54
requirebin sketch
var Model = require('ampersand-model');
var Foo = Model.extend({
props: {
keys: {
type: 'object',
default: function () {return {};}
}
},
echo: function () {
@jedireza
jedireza / index.js
Created September 18, 2014 19:53
requirebin sketch
// example using the raf module from npm. try changing some values!
var requestAnimationFrame = require("raf")
var canvas = document.createElement("canvas")
canvas.width = 500
canvas.height = 500
document.body.appendChild(canvas)
var context = canvas.getContext("2d")
lab.experiment('kittens', function () {
var resultsOfAsync;
lab.before(function (done) {
// set the value
resultsOfAsync = 'awesome stuff';
// Wait 1 second
var casper = require('casper').create({
viewportSize: { width: 1024, height: 768 }
});
var rootUrl = 'http://drywall.herokuapp.com/';
casper.start(rootUrl, function() {
this.evaluate(function(){
$('code').remove();
});