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
//First way | |
Promise.resolve(userModel.findOneAndUpdate({uid: myUserId}, updatedUserModel, { | |
upsert: true, | |
"new": false | |
}).exec()) | |
.then(function (user) { | |
... | |
}) | |
.spread(function markNotificationsAsRead(unreadNotifications) { | |
... |
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' | |
const router = require('express').Router() | |
const Project = require('../models/project') | |
const Build = require('../models/build') | |
// require('mongoose').Promise = require('bluebird') this is already done elsewhere | |
router.param('projectname', (req, res, next, id) => { | |
if (!id) { |
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
// ... | |
config.map([ | |
{route: ['arraytest', 'arraytest/:test'], name: 'test', moduleId: 'arraytest/arraytest', title: 'test'} | |
]); | |
// ... |
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 {inject, LogManager} from 'aurelia-framework'; | |
import {HttpClient} from 'aurelia-fetch-client'; | |
import _ from 'lodash'; | |
import 'fetch'; | |
const refreshRateInSeconds = 30; | |
@inject(HttpClient, LogManager) | |
export class Users { | |
heading = 'Current Builds'; |
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 Thing = { | |
load: function() { | |
var resolve, reject; | |
function finished() { | |
resolve({}) | |
} | |
function errored() { | |
reject({}); |
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
config: | |
target: 'http://mydomain.com/myApi' | |
phases: | |
# Warm Up | |
- duration: 30 | |
arrivalRate: 5 | |
# Ramp Up | |
- duration: 60 | |
arrivalRate: 5 |
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
/*class Neuron { | |
Neuron(x, y) { | |
this.location = {x: x, y: y}; | |
this.connections = []; | |
this.sum = 0; | |
} | |
feedForward(input) { | |
this.sum +=input; | |
if(this.sum >1) { | |
this.fire(); |
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
this.addNewListener = function(user) { | |
joinChannel(user.name); | |
return addNewChannelCache(user) | |
.then(function(data) { | |
return cache.getAsync(user.name); | |
}) | |
.then(function(obj) { | |
if (obj == null) { | |
throw new Exception('Object was not in cache'); |
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
<template> | |
<require from="~/_templates/sidebar/sidebar"></require> | |
<require from="~/_templates/topbar/topbar"></require> | |
<div class="container body"> | |
<div class="main_container"> | |
<!-- sidebar menu --> | |
<side-bar class="side-bar"></side-bar> | |
<!-- /sidebar menu --> | |
<!-- top navigation --> |
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'; | |
const Benchmark = require('benchmark'); | |
const benchmarkOutput = require('beautify-benchmark'); | |
var suite = new Benchmark.Suite; | |
function litteral() { | |
return { | |
a: 3, |
OlderNewer