Skip to content

Instantly share code, notes, and snippets.

View mikeal's full-sized avatar

Mikeal Rogers mikeal

View GitHub Profile
% npm install -g learnyounode 2>&1 > pbcopy ~/tmp/nodeschool
npm http GET https://registry.npmjs.org/learnyounode
npm http 304 https://registry.npmjs.org/learnyounode
npm http GET https://registry.npmjs.org/duplexer
npm http GET https://registry.npmjs.org/through
npm http GET https://registry.npmjs.org/boganipsum
npm http GET https://registry.npmjs.org/hyperquest
npm http GET https://registry.npmjs.org/through2-map
npm http GET https://registry.npmjs.org/bl
npm http GET https://registry.npmjs.org/workshopper
/Users/mikeal/Documents/git/countryico/node_modules/browserify/node_modules/insert-module-globals/index.js:76
return tr.queue(row);
^
TypeError: Object #<Stream> has no method 'queue'
at Stream.write (/Users/mikeal/Documents/git/countryico/node_modules/browserify/node_modules/insert-module-globals/index.js:76:23)
at Stream.stream.write (/Users/mikeal/Documents/git/countryico/node_modules/browserify/node_modules/insert-module-globals/node_modules/through/index.js:22:11)
at Stream.ondata (stream.js:51:26)
at Stream.EventEmitter.emit (events.js:95:17)
at drain (/Users/mikeal/Documents/git/countryico/node_modules/browserify/node_modules/through/index.js:36:16)
at Stream.stream.queue.stream.push (/Users/mikeal/Documents/git/countryico/node_modules/browserify/node_modules/through/index.js:45:5)
@mikeal
mikeal / gist:6685843
Last active December 23, 2015 19:58
Response to comments by Issac Roth of StrongLoop

This is rather out of date and we've all moved past it. Me and Issac are cool now.

pic

function parselink (headers) {
var links = {}
if (!headers.link) {
return {}
}
headers.link.split(',').forEach(function (s) {
s = s.split(';')
var url = s[0].slice(s[0].indexOf('<')+1, s[0].length - 1)
, name = s[1].slice(' rel="'.length, s[1].length - 1)
;
@mikeal
mikeal / gist:6137274
Last active December 20, 2015 13:18
NodeBase chat on Search
@mikeal
mikeal / gist:6137273
Created August 2, 2013 03:20
NodeBase chat on Search
@mikeal
mikeal / gist:6084298
Last active December 20, 2015 06:18
Been rather busy....

Because I've been so busy lately I haven't really had a chance to talk about anything I've built or been using, but i've been publishing so many new modules it's worth going back over.

Real quick, Getable is a mobile/desktop ordering and fullfillment application for commercial construction. Think mobile amazon/ebay for large construction jobsites.

First off, everything is realtime, using engine.io with everything but long polling turned off. We tried leaving websockets on but there were some nasty bits that made the connection die and not come back on iPhone which we just couldn't debug in time so we turned it off.

Engine.io is a great module as it just provides a simple duplex stream-like (more on this later) interface that upgrades itself when available. This meant that in order to get some use out of it I had to write a few modules.

eiojson sends JSON messages rather than strings bidirectiona

/*! normalize.css v1.0.1 | MIT License | git.io/normalize */audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none;height:0}[hidden]{display:none}abbr[title]{border-bottom:1px dotted}strong{font-weight:bold}cite,em{font-style:normal}q{quotes:none}q:before,q:after{content:'';content:none}img{border:0;vertical-align:bottom;-ms-interpolation-mode:bicubic}svg:not(:root){overflow:hidden}table{border-collapse:collapse;border-spacing:0}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}small{font-size:80%}body{margin:0}a:focus{outline:thin dotted}a:active,a:hover{outline:0}body{font:13px/1.25 "Helvetica Neue",Helvetica,Arial;color:#5f5f5f}li{list-style-type:none}fieldset{border:0;margin:0;padding:0}button,input,select,textarea{font-family:"Helvetica Neue",Helvetica,Arial}button,label{cursor:pointer}h1,h2,h3,h4,h5,h6{font-weight:300;*font-weight:normal}b{font-weight:300;*font-weight:normal}.fz-xs,.fz-xxs{fo
@mikeal
mikeal / regcache.js
Created July 23, 2013 22:35
LRU cache for the npm registry.
var lru = require('lru-cache')
, couchwatch = require('couchwatch')
, request = require('request')
;
function RegistryCache () {
this.cache = lru()
this.watch = couchwatch('http://isaacs.iriscouch.com/registry', -1)
this.watch.on('row', function (change) {
this.cache.del(change.id)
@mikeal
mikeal / gist:5986692
Created July 12, 2013 18:31
List all browserified files sorted by size.
ls -lrt $(node node_modules/.bin/browserify --list app/app.js) | awk '{print $5 " " $9}' | sort -n