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
define(['l!app/vendor/client/d3'], functtion () { | |
// library code | |
}); |
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 getAttributeValues(html) { | |
var htmlSubstr = html, | |
match = true, | |
values = [], | |
start = 0; | |
while (match) { | |
htmlSubstr = htmlSubstr.substr(start); | |
match = htmlSubstr.match(/<[^>]*\s(?:some-attribute-name=["']([^"']*)["'])[^>]*>/); | |
if (match) { |
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 fetch = Backbone.Collection.prototype.fetch; | |
var reset = Backbone.Collection.prototype.reset; | |
Backbone.Collection.prototype.fetch = function (options) { | |
if (options.unshift || options.push) { // force a reset | |
options.reset = true; | |
} | |
return fetch.call(this, options); | |
}; |
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
// server start up | |
var requirejs = require('requirejs'); | |
requirejs.config({ | |
paths: {}, // bunch of paths | |
baseUrl: 'dirpath' | |
}); | |
// request handler | |
// http request - much more going on here, but this is basically what happens | |
requirejs.optimize({ baseUrl: 'anotherdirpath', paths: {} }, function () { |
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
NS.Application = Marionette.Application.extend({ | |
constructor: function () { | |
var that = this, events; | |
Marionette.Application.prototype.constructor.apply(this, arguments); | |
events = { | |
on: function (topic, func, object) { | |
this.vent.on(topic, func, (object ? object : undefined)); |
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
// main module | |
define(['core/text!template/main.html', 'js/foo', 'js/bar', 'js/baz'], function (template, foo, bar, baz) { }); | |
// build.json used for optimize | |
{ | |
"baseUrl": "./src/client", | |
"dir": "./web", |
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 q = require('/home/wwwyzzerdd/node_modules/q'), | |
fs = require('fs'); | |
var foo = function () { | |
var deferred = q.defer(); | |
fs.readFile('in.txt', 'utf8', deferred.makeNodeResolver()); | |
return deferred.promise; | |
}; | |
var read = function () { |
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
global | |
maxconn 4096 | |
pidfile /var/run/haproxy.pid | |
debug | |
defaults | |
mode http | |
frontend all | |
bind 0.0.0.0:80 |
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
_.mixin({ | |
validChain: function (chain, test) { | |
var parts = chain.split('.'), valid = false, struct = window; | |
if (parts[0] === 'window') parts.splice(0, 1); | |
valid = _.all(parts, function (part) { return struct = struct[part]; }); | |
if (test && valid) { | |
if (typeof test === 'function') | |
return test(struct); |
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 () { | |
if (window.indexedDB) return false; | |
if (!window.openDatabase) throw "get yourself a decent browser"; | |
var indexedDB = function () {}; // begin shim | |
window.indexedDB = window.indexedDB || indexedDB; | |
})(); |
NewerOlder