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 simpleMerge (baseObj, extensionObj){ | |
| return Object.keys(extensionObj).reduce(function (baseObj, propertyKey) { | |
| baseObj[propertyKey] = extensionObj[propertyKey]; | |
| return baseObj; | |
| }, baseObj); | |
| } |
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
| 'use strict'; | |
| var routeFunctions = { | |
| delete: {}, | |
| get: {}, | |
| post: {}, | |
| put: {} | |
| }; | |
| function routeStub(method, path, action) { |
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 () { | |
| 'use strict'; | |
| function Vector() { | |
| Vector.attachPoints(this, arguments); | |
| } | |
| // Inherted behaviors | |
| Vector.prototype = { |
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
| { | |
| "src": "path/to/source", | |
| "defaultEncoding": "utf8", | |
| "preserveBOM": false, | |
| "dest": "path/to/destionation/", | |
| "ext": ".extensions.must.contain.dots", | |
| "cwd": "start/in/this/directory/", | |
| "expand": { | |
| "cwd": true, | |
| "match": ["file globbing patterns"], |
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
| // Serving static files in a named directory, served from the root path | |
| app.use(express.static('path/to/static/files')); // This will pick up deep references within named directory | |
| // http://localhost:3000/js/foo.js <- foo.js lives in path/to/static/files/js/foo.js | |
| // Serving files from a virtual directory | |
| app.use('/blar', express.static('path/to/static/files')); |
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 xhr = (function () { | |
| 'use strict'; | |
| function buildParamPair (requestData, paramList, key) { | |
| paramList.push(key + '=' + requestData[key].toString()); | |
| return paramList; | |
| } | |
| function buildGetParams (requestData) { | |
| return Object.keys(requestData).reduce(buildParamPair.bind(null, requestData)).join('&'); |
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 clone (originalValue, depth) { | |
| var depthOkay = j.isUndefined(depth) || j.geq(depth, 0), | |
| copyOkay = j.isType('object', originalValue) || j.isType('array', originalValue); | |
| function copy () { | |
| var keys = Object.keys(originalValue), | |
| container = j.isArray(originalValue) ? [] : {}; | |
| j.each(function (key) { | |
| var newDepth = j.isNumber(depth) ? depth - 1 : undefined; |
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 cacheFactory = (function(){ | |
| 'use strict'; | |
| function RequestCache(requestFn){ | |
| this.callQueue = queueFactory.build(); | |
| this.requestFn = requestFn; | |
| this.dataCache = { | |
| requestSent: false, | |
| response: null |
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 queueFactory = (function(){ | |
| 'use strict'; | |
| function Queue(){ | |
| this.queueHead = null; | |
| this.queueLast = null | |
| } | |
| Queue.prototype = { | |
| getHeadValue: function(){ |
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 listItemFactory = (function(){ | |
| 'use strict'; | |
| function ListItem(value){ | |
| this.value = value; | |
| this.nextPointer = null; | |
| } | |
| ListItem.prototype = { | |
| val: function(){ |