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
> coinstac@2.0.0 lint /home/rof/src/github.com/MRN-Code/coinstac
> eslint '**/*.js' '**/bin/*'
> coinstac@2.0.0 test /home/rof/src/github.com/MRN-Code/coinstac
> lerna run test --concurrency=1
Lerna v2.0.0-beta.32
> coinstac-client-core@2.5.0 test /home/rof/src/github.com/MRN-Code/coinstac/packages/coinstac-client-core
~/Sites/quarterback/packages/steelpenny$ npm t
> steelpenny@5.3.2 test /Users/creed/Sites/quarterback/packages/steelpenny
> nyc mocha 'test/{integration,unit}/*.js'
Running with COINS_ENV: development
Using default dbmap.json
(node:2687) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
@swashcap
swashcap / models-error-test.js
Created April 25, 2017 21:10
Testing error sanitization
'use strict';
const assert = require('assert');
class ModelsError extends Error {
constructor(message, file, fileType) {
super(message);
this.name = 'ModelsError';
this.file = file;
'use strict';
var _ = require('lodash');
var FreeSurfer = require('freesurfer-parser');
var path = require('path');
var os = require('os');
var fs = require('fs');
var glob = require('glob')
var mkdirp = require('mkdirp');
var pify = require('pify');
(function () {
'use strict'
function getLi(username, name) {
var li = document.createElement('li'),
small = document.createElement('small')
small.textContent = name
li.className = 'js-navigation-item'
li.setAttribute('data-mentionable-type', 'user')
@swashcap
swashcap / toggle-header.js
Created February 10, 2017 19:53
GitHub Header Toggler
// Original:
(function(doc, className) {
var header = doc.querySelector('[role=banner]'),
button = doc.createElement('button'),
classList = header.classList,
light = className + 'light',
dark = className + 'dark',
isLight
button.className = 'btn'
button.style = 'position:sticky;bottom:1em;left:1em'
@swashcap
swashcap / mkdirtouch.js
Created January 20, 2017 05:15
`mkdir -p` and `touch` rolled in one
var path = require('path')
var mkdirp = require('mkdirp')
var touch = require('touch')
var file = process.argv[2]
function cb(error) {
if (error) {
console.error(error)
} else {
{
"users": [
{
"birthday": 1480634264530,
"email": "Kira.Rosenbaum83@hotmail.com",
"favoriteColor": "indigo",
"id": "43aa36bb-7c93-4651-a317-1af1b4879856",
"image": "https://s3.amazonaws.com/uifaces/faces/twitter/mrjamesnoble/128.jpg",
"joinDate": 1480634264531,
"name": "Mandy Schowalter",
$ 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"
@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.
*