Skip to content

Instantly share code, notes, and snippets.

@Nepoxx
Nepoxx / Thing.js
Last active December 10, 2015 17:05
testing module that uses bluebirdd
var Thing = {
load: function() {
var resolve, reject;
function finished() {
resolve({})
}
function errored() {
reject({});
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';
@Nepoxx
Nepoxx / app.js
Last active November 27, 2015 21:20
// ...
config.map([
{route: ['arraytest', 'arraytest/:test'], name: 'test', moduleId: 'arraytest/arraytest', title: 'test'}
]);
// ...
'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) {
//First way
Promise.resolve(userModel.findOneAndUpdate({uid: myUserId}, updatedUserModel, {
upsert: true,
"new": false
}).exec())
.then(function (user) {
...
})
.spread(function markNotificationsAsRead(unreadNotifications) {
...