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
language: node_js | |
node_js: ["0.11", "0.10"] | |
env: | |
CODECLIMATE_REPO_TOKEN: <your_token> | |
before_script: | |
- npm install -g istanbul | |
- npm install -g mocha | |
- npm install -g codeclimate-test-reporter |
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 Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 Promise = require('bluebird'); | |
function doSomethingAsync(data, callback) { | |
return $blueBirdPromise | |
.tap(function() { | |
console.log('Op is successful'); | |
}) | |
.nodeify(callback); | |
}; |
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
import co from 'co' | |
// Generator controller, | |
// this.models refers to Sequelize models added with server.bind() | |
function* loginController(request) { | |
let user = yield this.models.User.find({ | |
where: { | |
email: request.payload.email | |
} |
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
FeedItem.aggregate({ | |
// you want to group all the things by status key | |
$group: { | |
_id: '$statusName', // assuming you have `statusName` field in your collections, prefix with `$`. | |
timeOn: { | |
// $cond takes 3 arguments as an array, cond expression, true expression and false expression | |
$cond: [ | |
// if event was active, we want to add the milliseconds to timeOn | |
{ $eq: [ "$wasActive", true ] }, | |
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 _ = require('lodash'); | |
Statuses | |
.findAll() | |
.sort({ | |
'$date': -1 //check if $ should be here and if -1 is the order you want | |
}) | |
.then(function(statuses) { | |
var timeOn = 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
Line;Direction;StationA;StationB;Distance;Time | |
Bakerloo ;Southbound;HARROW & WEALDSTONE;KENTON;1,74;2,23 | |
Bakerloo ;Southbound;KENTON;SOUTH KENTON;1,40;1,88 | |
Bakerloo ;Southbound;SOUTH KENTON;NORTH WEMBLEY;0,90;1,50 | |
Bakerloo ;Southbound;NORTH WEMBLEY;WEMBLEY CENTRAL;1,27;1,92 | |
Bakerloo ;Southbound;WEMBLEY CENTRAL;STONEBRIDGE PARK;1,71;2,23 | |
Bakerloo ;Southbound;STONEBRIDGE PARK;HARLESDEN;1,53;2,13 | |
Bakerloo ;Southbound;HARLESDEN;WILLESDEN JUNCTION;1,05;1,65 | |
Bakerloo ;Southbound;WILLESDEN JUNCTION;KENSAL GREEN;1,50;2,47 | |
Bakerloo ;Southbound;KENSAL GREEN;QUEENS PARK;1,32;2,65 |
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
// middleware.js | |
import onHeaders from 'on-headers'; | |
export default function setupMiddleware(headers = [], options = {}) { | |
return function onRequest(req, res, next) { | |
// Do the action when headers are emitted for given res | |
onHeaders(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
Minutes;Value | |
0.000000;0.060563 | |
0.008333;0.061365 | |
0.016667;0.062198 | |
0.025000;0.063057 | |
0.033333;0.063888 | |
0.041667;0.064706 | |
0.050000;0.065535 | |
0.058333;0.066328 | |
0.066667;0.067090 |
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
Minutes;Value | |
0.000000;0.004045 | |
0.008333;0.004052 | |
0.016667;0.004097 | |
0.025000;0.004189 | |
0.033333;0.004260 | |
0.041667;0.004290 | |
0.050000;0.004309 | |
0.058333;0.004332 | |
0.066667;0.004360 |
OlderNewer