This file contains hidden or 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 getGistFile (gist, filename, cb) { | |
$.ajax({ | |
url: 'https://api.github.com/gists/' + gist, | |
type: 'GET', | |
dataType: 'jsonp' | |
}).success( function(gistdata) { | |
var content = gistdata.data.files[filename].content; | |
cb(null, JSON.parse(content)) | |
}).error( function(e) { | |
cb(e) |
This file contains hidden or 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
[ | |
{ | |
"text": "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.", | |
"author": "Martin Golding" | |
}, | |
{ | |
"text": "All computers wait at the same speed.", | |
"author": "Unknown" | |
}, | |
{ |
This file contains hidden or 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 cb = _.compose(_.identity, console.log.bind(console)); | |
asyncFunctionThatReturnsNullResult(cb); | |
// => null {result: [Results..]} |
This file contains hidden or 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
/* | |
License | |
do waht the fuck you want to public license | |
*/ | |
(function () { | |
var moment; | |
moment = this.moment; | |
moment.fn.isSunday = function (start) { | |
return this.day() === 0 |
This file contains hidden or 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 logRenders () { | |
_.each(Template, function (template, name) { | |
var oldRender = template.rendered; | |
var counter = 0; | |
template.rendered = function () { | |
console.log(name, "render count: ", ++counter); | |
oldRender && oldRender.apply(this, arguments); | |
}; | |
}); |
This file contains hidden or 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
sessionLog = (function(){ | |
var loggers = {}; | |
function sessionLog(key,stop){ | |
if(key in loggers) loggers[key].stop(); | |
if(stop) return; | |
else { | |
loggers[key] = Deps.autorun(function(){ | |
console.log('Session.get("'+key+'") : ',Session.get(key)); | |
}); |
This file contains hidden or 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
// http://stackoverflow.com/questions/1303872/trying-to-validate-url-using-javascript | |
window.isValidURL = (function() {// wrapped in self calling function to prevent global pollution | |
//URL pattern based on rfc1738 and rfc3986 | |
var rg_pctEncoded = "%[0-9a-fA-F]{2}"; | |
var rg_protocol = "(http|https):\\/\\/"; | |
var rg_userinfo = "([a-zA-Z0-9$\\-_.+!*'(),;:&=]|" + rg_pctEncoded + ")+" + "@"; | |
var rg_decOctet = "(25[0-5]|2[0-4][0-9]|[0-1][0-9][0-9]|[1-9][0-9]|[0-9])"; // 0-255 |
This file contains hidden or 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
chance.url = function(){ | |
return 'http://' + this.domain() + '/' + this.sentence().replace(/ /g,'_') + 'html'; | |
}; |
This file contains hidden or 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 getUrl(query,type,callback){ | |
var access = Meteor.user().services.facebook.accessToken | |
var url = 'https://graph.facebook.com/search?' | |
url += $.param({ | |
q:query, | |
type : type, | |
access_token : access | |
}); | |
return $.get(url,callback); | |
} |
This file contains hidden or 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
define([ | |
"underscore", | |
"backbone", | |
"marionette", | |
"vent" | |
], | |
/** | |
* Creates the primary `Marionette.Application` object that runs the admin framework. Provides a central point | |
* from which all other sub-applications are started, shown, hidden, and stopped. |