Skip to content

Instantly share code, notes, and snippets.

View mnichols's full-sized avatar

Mike Nichols mnichols

View GitHub Profile
// 20170217013214
// http://localhost:3002/queries?contextId=333
{
"feed": [
"800",
"801",
"802",
"803"
],
@mnichols
mnichols / es
Created February 16, 2017 18:54
var command = {
command: 'createContext',
id: '42',
type: 'boards'
}
function raiseEvent(event) {
//persistEvent(event)
publishEvent(event)
}
@mnichols
mnichols / interactions.js
Created February 14, 2017 16:37
initializing conversations
/**
GET /queries?clientId=42&type=boards
404 Not Found
POST /commands
{ commands: [{ correlationId: 789, id: 456, command: 'createContext', clientId: '42', type: 'boards' }]}
202 Not Dun
Location: /poll?correlationId=789
GET /poll?correlationId=789
const noop = () => {}
const identity = obj => obj
function bus() {
let subscription = () => {}
return {
publish(...data) {
return subscription(...data)
},
subscribe(fn) {
import objectPath from "object-path"
function assertValue(funcName, value) {
if(typeof value !== 'undefined') {
return
}
throw new Error(`You are returning 'undefined' from ${funcName}. This is a bug.`)
}
/**
* nestComponent
(circleup) ~/dev/circleup/CircleUp-Main-Site$ ./manage.py runserver
Performing system checks...
System check identified no issues (6 silenced).
You have unapplied migrations; your app may not work properly until they are applied.
Run 'python manage.py migrate' to apply them.
February 09, 2016 - 16:26:10
Django version 1.8.4, using settings 'settings'
{
inflight: undefined
, fetch: function() {
if(this.inflight && this.inflight.then) {
return this.inflight.then(fetch.bind(this))
}
return this.inflight = Promise.resolve().then(function() {
//cant remember what jquery xhr api is ...i think 'done' is the thing here.
return this.save().done(function(res){
this.inflight = undefined
@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 <[email protected]>
* 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(
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 / 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');