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
{ | |
"watch" : [ | |
"./", | |
"lib", | |
"src", | |
"plugins" | |
], | |
"ext" : ".js|.css|.html", | |
"ignore" : [ | |
"/vendor/*", |
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
// you dont need new but can have new | |
var api = apiConstructor(); | |
var success = function(res){ | |
console.log(res); | |
}; | |
//passes error object eg. -> new Error("this is an error") | |
var error = function(err){ | |
console.log(err.message); | |
}; |
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
~function(){ | |
console.log("Works!") | |
}() |
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
Marrow.prototype.forEach = function(obj, fn){ | |
if("forEach" in obj){ | |
obj.forEach(fn); // native knows best | |
}else if("length" in obj){ // array | |
for(var i = 0; i < obj.length; i += 1){ | |
fn(obj[i], i); | |
} | |
}else if(typeof obj === "object"){ // object | |
for(var key in obj){ |
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
function disqus_config() { | |
this.callbacks.afterRender.push(function() { // push to aviod any overwrites | |
jQuery(window).trigger("resize"); // trigger a resize | |
}); | |
} |
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
// eg. | |
var | |
Mangos = require("mangos"), | |
connection = new Mangos("supercooldb", "127.0.0.1", 27101), | |
model = { | |
//when adding or updating or returning | |
defaults : { // default values for model | |
first_name : "Bob", | |
last_name : "Hope", | |
notifications : true |
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
module.exports = function( hbs ){ | |
hbs.registerHelper( "js", function( context ){ | |
if( typeof js === "function" ){ | |
return js( context ); | |
}else{ | |
return "" | |
} | |
}); |
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
// this is to direct check the model store | |
// App.fetcher.modelStore.get("user", "bork", true); | |
// ^ ^ ^ | |
// model userid should return | |
// to store a collection and to 'fake' a call | |
// you create a collection with the options the fetch params | |
// then you say collection.store(); | |
// that should fake an individual call so if one is made | |
// bam we have the model |
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
this.listenTo( user, 'change:invites', function(){ | |
self.$invites.text( user.get( 'invites' ) ); | |
}); |
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
ajax( 'url', { /*data */ }, function ( err, res ) { | |
if ( err ){ | |
// handle | |
return null; | |
} | |
// good | |
}) |