Skip to content

Instantly share code, notes, and snippets.

View mnichols's full-sized avatar

Mike Nichols mnichols

View GitHub Profile
@mnichols
mnichols / 16step.coffee
Created November 29, 2012 17:40 — forked from peterc/16step.coffee
Simple 16 step drum machine using CoffeeScript and Node
# Simple 16 step drum machine experiment with Node and CoffeeScript
# by Peter Cooper - @peterc
#
# Inspired by Giles Bowkett's screencast at
# http://gilesbowkett.blogspot.com/2012/02/making-music-with-javascript-is-easy.html
#
# Screencast demo of this code at http://www.youtube.com/watch?v=qWKkEaKL6DQ
#
# Required:
# node, npm and coffee-script installed
@mnichols
mnichols / rebase
Last active December 18, 2015 18:19
Rebasing
git pull origin {tracking branch} # ie 'dev'
git checkout my-feature
git rebase {tracking branch}
#resolve conflicts
git checkout {tracking branch}
git merge my-feature
git push origin {tracking branch}
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserify = require('gulp-browserify'),
concat = require('gulp-concat'),
embedlr = require('gulp-embedlr'),
refresh = require('gulp-livereload'),
lrserver = require('tiny-lr')(),
express = require('express'),
livereload = require('connect-livereload')
livereloadport = 35729,

How to share a folder with a docker container on OSX

Mounting shared folders between OSX and the docker container is tricky due to the intermediate boot2docker VM. You can't use the usual docker -v option as the docker server knows nothing about the OSX filesystem - it can only mount folders from the boot2docker filesystem. Fortunately, you can work around this using SSHFS.

@mnichols
mnichols / nginx.conf
Last active August 29, 2015 14:07 — forked from plentz/nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@mnichols
mnichols / gist:e10919f68ec13fc2a48f
Created October 17, 2014 15:38
angular-shim.js
//index.html -> puts angular on global
<script src="http://cdn.to.angular.js"></script>
//angular-shim.js
module.exports = angular
//package.json
{
"browser": {
"angular": "./client/angular-shim.js"
@mnichols
mnichols / flatten-rashid-spec.js
Created July 31, 2015 02:36
flatten-rashid :)
var test = require('tape')
//utils
function isObject(target) {
return toString.call(target) == '[object Object]'
}
function id(nodes,keys) {
return nodes.concat(keys).join('.')
@mnichols
mnichols / gulp-es6-watchify-tape.js
Created September 1, 2015 16:46
gulp+es6+watchify+tape
/* thanks to https://github.com/mpj/cannonville/blob/master/gulpfile.js
*/
var gulp = require('gulp')
var babel = require('gulp-babel')
var babelify = require('babelify');
var watch = require('gulp-watch')
var sourcemaps = require('gulp-sourcemaps')
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var preventMultipleInstances = function(window) {
var socket = (process.platform === 'win32') ? '\\\\.\\pipe\\myapp-sock' : path.join(os.tmpdir(), 'myapp.sock');
net.connect({path: socket}, function () {
var errorMessage = 'Another instance of ' + pjson.productName + ' is already running. Only one instance of the app can be open at a time.'
dialog.showMessageBox(window, {'type': 'error', message: errorMessage, buttons: ['OK']}, function() {
window.destroy()
})
}).on('error', function (err) {
if (process.platform !== 'win32') {
// try to unlink older socket if it exists, if it doesn't,
@mnichols
mnichols / poppy.js
Last active August 8, 2016 01:00
CT test
/**
* UAParser.js v0.7.9
* Lightweight JavaScript-based User-Agent string parser
* https://github.com/faisalman/ua-parser-js
*
* Copyright © 2012-2015 Faisal Salman <fyzlman@gmail.com>
* Dual licensed under GPLv2 & MIT
*/(function(e,t){"use strict";var n="0.7.9",r="",i="?",s="function",o="undefined",u="object",a="string",f="major",l="model",c="name",h="type",p="vendor",d="version",v="architecture",m="console",g="mobile",y="tablet",b="smarttv",w="wearable",E="embedded",S={extend:function(e,t){for(var n in t)"browser cpu device engine os".indexOf(n)!==-1&&t[n].length%2===0&&(e[n]=t[n].concat(e[n]));return e},has:function(e,t){return typeof e=="string"?t.toLowerCase().indexOf(e.toLowerCase())!==-1:!1},lowerize:function(e){return e.toLowerCase()},major:function(e){return typeof e===a?e.split(".")[0]:t}},x={rgx:function(){var e,n=0,r,i,a,f,l,c,h=arguments;while(n<h.length&&!l){var p=h[n],d=h[n+1];if(typeof e===o){e={};for(a in d)f=d[a],typeof f===u?e[f[0]]=t:e[f]=t}r=i=0;while(r<p.length&&!l){l=p[r++].exec(