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
| // 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
| { | |
| "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
| (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
| '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 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
| var statsApi = (function () { | |
| 'use strict'; | |
| var square = pow(2); | |
| var squareRoot = pow(0.5); | |
| function getStandardDeviation (values) { | |
| var xBar = getMean(values); | |
| var computedValues = values.map(subtractMeanAndSquare(xBar)); | |
| return squareRoot(getMean(computedValues)); |
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 viewHelper = (function () { | |
| 'use strict'; | |
| function parseNumberValues (valueStr) { | |
| return valueStr.trim().split(/[\s\,]+/).map(parseFloat); | |
| } | |
| return { | |
| parseNumberValues: parseNumberValues | |
| }; |
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
| <html> | |
| <body> | |
| <input type="text" value="" name="sample" id="sample" /> | |
| <button id="compute">Compute Mean and Standard Deviation</button> | |
| <h4>Mean:</h4> | |
| <p id="mean">0</p> | |
| <h4>Standard Deviation:</h4> |
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 testRunner = (function () { | |
| 'use strict'; | |
| function isMatch (expectedValue, actualValue) { | |
| var equalMatch = expectedValue === actualValue; | |
| var NaNMatch = Number.isNaN(expectedValue) && Number.isNaN(actualValue); | |
| return equalMatch || NaNMatch; | |
| } | |