Skip to content

Instantly share code, notes, and snippets.

View nmccready's full-sized avatar

nmccready nmccready

View GitHub Profile
@nmccready
nmccready / shell.js
Last active September 19, 2018 19:58
easy running / chaining of spawn for gulp
const { spawn } = require('child_process');
const through = require('through2');
const Promise = require('bluebird');
const EventEmitter = require('events');
const logger = require('../debug').spawn('gulp:shell');
class NonZeroExit extends Error {
constructor(code, info) {
super();
@nmccready
nmccready / README.md
Created May 30, 2018 23:19
macOS HighSierra vbox

macOS High Sierra VBox

VM setup

  • create new virtual machince macOS and target HighSierra 64
  • ICH9 Chipset
  • Network should be (Intel PRO/1000 MT Server)
  • Display Memeory max out to 128mb
  • cpu memory ~ 4096
  • 2 cpus
@nmccready
nmccready / parse.sh
Created May 29, 2018 21:38
parse simple options shell
#!/bin/sh
while [[ "$#" > 0 ]]; do case $1 in
-d|--dependencies) dependencies=3;;
-n|--dry-run) dryRun=2;;
-t|--tag-only) tagOnly=1;;
*) echo "Unknown parameter passed: $1"; exit 1;;
esac; shift; done
@nmccready
nmccready / gitRemoveAllMyRemotesMerged.sh
Created May 15, 2018 22:48
clean your remote branches
#!/bin/sh
#http://stackoverflow.com/questions/6127328/how-can-i-delete-all-git-branches-which-have-been-merged
git branch -r --merged origin/master | grep -v "^.*master" | grep nmccready | sed s:origin/:: |xargs -n 1 git push --delete origin
@nmccready
nmccready / StringStream.js
Created April 18, 2018 15:48
node streams utlities
const { Readable } = require('stream');
module.exports = class StringStream extends Readable {
constructor(str) {
super();
this.push(str);
this.push(null);
}
_read() {}
};
@nmccready
nmccready / promise.js
Created April 9, 2018 21:32
poorman promises (some of bluebird , some of RSVP)
import { Promise } from 'es6-promise';
import '../async';
import { map as loMap } from '../../utils/lodash';
import { PromiseTypeError } from '../../errors';
/* keeping bundle size down and shimming Promise utilities as we need them */
if (!Promise.TypeError) {
Promise.TypeError = PromiseTypeError;
}
@nmccready
nmccready / lodash.js
Created April 6, 2018 20:52
poor mans lodash
/*
Poor man's lodash to keep bundle down
*/
export function iteratee(obj, cb, { bail = false } = {}) {
for (const key in obj) {
if (key in obj) {
const maybeBreak = cb(obj[key], key);
if (bail && maybeBreak === false) break;
}
}
@nmccready
nmccready / docker-ember.sh
Created April 6, 2018 15:28
docker run container in bash
docker run --rm -it -v $(pwd):/myapp -p 4200:4200 -p 7020:7020 -p 7357:7357 danlynn/ember-cli:2.16.2 bash
@nmccready
nmccready / promise.js
Created April 3, 2018 17:37
promise pollyfills
import { Promise } from 'es6-promise';
import PromiseTry from 'es6-promise-try';
import './async';
if (!Promise.try) {
Promise.try = PromiseTry;
}
if (!Promise.try) {
Promise.try = PromiseTry;
@nmccready
nmccready / yarnUpdate.sh
Created March 31, 2018 03:49
reinstall older yarn globals
for i in `ls ~/.nvm/versions/node/v8.9.4/yarn/bin/`; do; yarn global add "$i"; done;