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
const app = require('express'); | |
app.use(require('./default-middleware')); | |
app.use(require('./router')); | |
module.exports = 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
'use strict'; | |
require('env2')('.env'); | |
const AWS = require('aws-sdk'); | |
const async = require('async'); | |
const Progress = require('cli-progress'); | |
AWS.config.region = 'eu-west-1'; | |
const s3 = new AWS.S3(); |
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
const AWS = require('aws-sdk'); | |
const assert = require('assert'); | |
const kinesis = new AWS.Kinesis({ region: 'eu-west-1' }); | |
function start () { | |
kinesis.describeStream({ StreamName: 'isearch' }, (err, result) => { | |
assert(!err); | |
console.log(result); | |
setInterval(write, 1000); |
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
const a = {}; | |
a.foo = 'bar'; | |
console.log(a); // { foo: 'bar' } | |
const b = 'foo'; | |
b += 'bar'; | |
console.log(b); // 'foo' |
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 = require('express')(); | |
app.get('/foo', function (req, res, next) { | |
res.send(req.path); | |
// here req.path === '/foo' | |
}); | |
app.use('/bar', function (req, res, next) { | |
res.send(req.path); | |
// here req.path === '/' |
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 getApp = require('./main'); | |
describe('App Tests', function () { | |
var app; | |
beforeEach(function (done) { | |
getApp(function (err, a) { | |
app = a; | |
done(err); |
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 requestHandler(req, res) { | |
fs.readFile('/my/file', function (err, file) { | |
if (err) { | |
res.status(500).send(); | |
} else { | |
res.send(file); | |
} | |
}); | |
} |
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
11:22 AM <lennym> Morning all, I'm having some issues with node-sass and npm, but only in certain contexts. I was hoping to talk it through to see if I'm doing anything obviously stupid. | |
11:23 AM <lennym> I have a project, which has a module as a dev dependency - both depend on node sass, and both run node sass as part of a postinstall script | |
11:24 AM <lennym> Except the postinstall script fails in node-sass for the child module with an error of "Cannot find module semver" here - https://github.com/sass/node-sass/blob/v2.1.1/lib/extensions.js#L1 | |
11:24 AM <lennym> When run not as a child dependency of the parent project it works fine. | |
11:24 AM <lennym> Both projects have the same (2.1.1) dependency of node-sass | |
11:25 AM <lennym> Now here's the kicker... it *only* fails as part of an npm install on our jenkins build server, I can't replicate locally. | |
11:26 AM <lennym> If anyone has any ideas or suggestions I'd be happy to hear them. |
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
#!/usr/bin/env node | |
var sass = require('node-sass'), | |
path = require('path'), | |
fs = require('fs'); | |
var src = path.resolve(__dirname, '../assets/sass/app.scss'), | |
out = path.resolve(__dirname, '../public/stylesheets/app.css'); | |
sass.render({ |
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 url = require('url'); | |
app.use(function (req, res, next) { | |
if (req.path.indexOf('&') > -1) { | |
var path = req.path.split('&')[0]; | |
res.redirect(url.format({ | |
pathname: path, | |
query: req.query | |
})); | |
} else { |