Skip to content

Instantly share code, notes, and snippets.

View colwem's full-sized avatar

Martin Colwell colwem

View GitHub Profile
create: function(context, newUser) {
// Initialize all the fields.
const d = new Date().getTime();
const userToClient = _.assign({
createdTime: d
}, defaults, newUser);
// Verify that the current user is an admin
isAdminPromise = userService.currentUser(context).then((currentUser) => {
if (get(environment, 'config.clients.user.adminToCreate', true)) {
eq
[ { total_runtime: 368,
total_step_runtime: 25,
average_step_runtime: 0.00025 },
{ total_runtime: 477,
total_step_runtime: 57,
average_step_runtime: 0.00057,
total_off_baseline: 106,
total_step_off_baseline: 25,
average_step_off_baseline: 0.00024999999999999995 } ]
import {
createAndPopulateGroup,
generateUser,
} from '../../../helpers/api-integration/v2';
import { each } from 'lodash';
describe('POST /groups/:id/invite', () => {
context('user is a member of the group', () => {
each({
'public guild': {type: 'guild', privacy: 'public'},
funcWithCallback(args, createCallback(obj));
function createCallback(obj) {
return function (err, data) {
//do stuff with data and obj
}
}
function! MoveToMiddle()
let end = strdisplaywidth(substitute(getline('.'), '\s*$', '', ''))
let start = indent('.')
call cursor(0, (start + end)/2)
endfunction
map gm :call MoveToMiddle()<cr>
function getConnection(connectionString) {
return Promise.try(() => {
return mongoose.connect(uri);
})
.disposer(() => {
mongoose.disconnect();
})
}
Promise.using(getConnection(uri), (connection) => {
@colwem
colwem / .js
Last active March 21, 2016 02:58
User.find({UTCCronTime: hour})
.each((user) => {
api.getUser(user);
})
.catch((err) => {
console.log(err);
});
'use strict';
riot.tag2('cron-time', ' <select onchange="{_update}">\n <option each="{hours}" value="{hour}" __selected="{selected}">{hour}</option>\n </select>\n', '', '', function(opts) {
const self = this;
function range(start, end) {
return Array.apply(Array, Array(1 + end - start)).map((_, i) => {
return i + start;
});
}
this.hours = range(opts.dayStart + 1, 24).map((hour) => {
.jumbotron
.container
.visible-xs-block
.center-block
img(
alt="AutoCron"
src="/images/logos/AutoCronLogo.svg")
.title.h1
| AutoCron
.subtitle.h1
'use strict';
const expect = require('chai').expect;
describe('foo', () => {
it('should finish', (done) => {
Promise
.reject(new Error())
.catch(() => expect(false).to.be.true)
.then(() => done(), done);