Skip to content

Instantly share code, notes, and snippets.

View swashcap's full-sized avatar
Writing code

Cory Reed swashcap

Writing code
View GitHub Profile
@swashcap
swashcap / coinstac-server-client.js
Created January 25, 2016 22:41
nodeapi/coinstac-server-core integration
// coinstac-server-client/index.js
'use strict';
var assign = require('lodash.assign');
var Pouchy = require('pouchy');
module.exports.handlersFactory = function(config) {
// Private, configured PouchDB/Pouchy instance
// May need async config of instance if it's Cloudant and security settings
@swashcap
swashcap / base.js
Last active February 5, 2016 02:24
Thin JOI Classes
/**
* @module base.js - COINSTAC Model
*/
'use strict';
const assign = require('lodash/assign');
const joi = require('joi');
const pick = require('lodash/pick');
/**
@swashcap
swashcap / freesurfer-multishot.js
Created February 5, 2016 22:24
COINSTAC Stuff
'use strict';
const _ = require('lodash');
const coinstacCommon = require('coinstac-common');
const coinstacAlgorithms = require('coinstac-distributed-algorithm-set');
const freesurferParser = require('freesurfer-parser');
const helpers = require('./path/to/helpers/');
const Analysis = coinstacCommon.Analysis;
const ComputationPipeline = coinstacCommon.ComputationPipeline;
@swashcap
swashcap / cli
Created February 15, 2016 22:27
Node’s Uncaught Exception
#!/usr/bin/env node
'use strict';
const logger = require('../src/utils/logger.js');
const pkg = require('../package.json');
const program = require('commander');
const server = require('../index.js').server;
const url = require('url');
@swashcap
swashcap / pick-ordered-values.js
Created April 4, 2016 00:24
Pick ordered values snippet
/**
* Pick ordered values.
*
* @example
* pickOrderedValues(
* ['wat', 'silly'],
* { silly: 100, thing: 200, wat: 300 }
* );
* // => [300, 100]
*
@swashcap
swashcap / instructions.md
Last active June 3, 2016 18:55
Directory Parsing Exercise

We’re considering changing the object shape for a simulator declaration (declaration.js in Sergey’s examples). Right now it looks like this:

const path = require('path');

module.exports = {
  users: [{
    username: 'user1',
    userData: [
      // Data here...
@swashcap
swashcap / makeTree.js
Last active November 1, 2016 18:19
Make a tree from a flat data structure
'use strict';
const { deepEqual } = require('assert');
/**
* Sample data structure.
*
* The items are roughly sorted already, with the top-level item as the root of
* the tree.
*
@swashcap
swashcap / gulpfile.js
Last active November 23, 2016 03:02
Gulpifying Jekyll
/* global -$ */
'use strict';
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var browserSync = require('browser-sync');
var reload = browserSync.reload;
gulp.task('styles', function () {
return gulp.src('app/css/main.scss')
$ vagrant up --debug
INFO global: Vagrant version: 1.8.7
INFO global: Ruby version: 2.2.5
INFO global: RubyGems version: 2.4.5.1
INFO global: VAGRANT_LOG="debug"
INFO global: VAGRANT_OLD_ENV_PS1="\\w$ "
INFO global: VAGRANT_OLD_ENV_TERM="xterm-256color"
INFO global: VAGRANT_OLD_ENV_NVM_DIR="/Users/creed/.nvm"
INFO global: VAGRANT_OLD_ENV_NODE_ENV="development"
INFO global: VAGRANT_OLD_ENV_SHLVL="1"