Skip to content

Instantly share code, notes, and snippets.

working hard to make the world better with software

Kent C. Dodds kentcdodds

working hard to make the world better with software
View GitHub Profile
View gist:783574f7b5a5cf7e5c55
function fetchJSON(options, cb) {
then(res => res.json()).
then(json => cb(null, json)).
catch(err => cb(err))

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set "Your Name"
npm set ""
npm set ""

npm adduser
kentcdodds / angular-static-server.js
Last active Nov 24, 2015 — forked from ryanflorence/static_server.js
Angular Static Server - Serves up static files. If the request doesn't match one, it'll send the hash version and lets Angular leverage html5Mode. Haven't tested it with Ember or others, but I imagine they'd work just as well. Thanks to rpflorence for the original version.
View angular-static-server.js
var http = require('http');
var url = require('url');
var path = require('path');
var fs = require('fs');
var base = path.join(process.cwd(), process.argv[2] || '');
var port = process.argv[3] || 8888;
var extensionRegex = /\.([0-9a-z]+)(?:[\?#]|$)/i;
var contentTypeMap = {
html: 'text/html',