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 express = require('express'); | |
var app = express(); | |
var jobs = express.Router(); | |
var properties = express.Router(); | |
var property = express.Router(); | |
jobs.route('/:id') | |
.get(function (req, res, next) { |
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 app = { | |
inspect: function () { | |
return 'a kitten!'; | |
} | |
}; | |
console.log(app); |
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 middleware = require('./my-middleware') | |
describe('middleware', function () { | |
var req, res; | |
beforeEach(function () { | |
req = { | |
session: { username: 'lennym' } | |
}, | |
res = {} |
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
... | |
"karma": "0.12.24", | |
"karma-browserify": "0.2.1", | |
"karma-chai": "0.1.0", | |
"karma-chrome-launcher": "0.1.5", | |
"karma-firefox-launcher": "0.1.3", | |
"karma-mocha": "0.1.9", | |
"karma-phantomjs-launcher": "0.1.4", | |
"karma-sinon-chai": "0.2.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
var https = require('https'); | |
var getLatestCoreVersion = function(major, cb) { | |
var json = ''; | |
var req = https.get({ | |
host: 'api.github.com', | |
path: '/repos/mozu/core-theme/releases', | |
headers: { | |
'User-Agent': 'thmaa', | |
'content-length': 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
var fs = require('fs'), | |
path =require('path'); | |
var dir = process.argv[2]; | |
if (!dir) { | |
console.error('Folder path must be defined.'); | |
console.log('Usage: node json-linter.js /path/to/test'); | |
process.exit(1); | |
} |
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
// example test script for module with http.get | |
// uses sinon, chai and mocha. | |
var Module = require('./my-module-that-does-http'); | |
var http = require('http'); | |
describe('Module', function () { | |
beforeEach(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 winston = require('winston'); | |
var config = require('./config'); | |
var logger = new winston.Logger({ | |
transports: [ | |
new winston.transports.Console({ colorize: true }), | |
new winston.transports.File({ filename: config['app-log'], json: false }) | |
], | |
exceptionHandlers: [ |
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
/** | |
Usage: `node domains.js --file <inputfile.csv> | |
**/ | |
var fs = require('fs'); | |
var argh = require('argh').argv; | |
var _ = require('underscore'); | |
var input = argh.file; | |
fs.readFile(input, function (err, filedata) { |
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
[ | |
{ | |
"userName": "alphagov", | |
"repo": "datainsight-frontend" | |
}, | |
{ | |
"userName": "alphagov", | |
"repo": "fourth-wall" | |
}, | |
{ |