Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓
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) {
fetch(options).
then(res => res.json()).
then(json => cb(null, json)).
catch(err => cb(err))
}
View readme.md

Getting Started with NPM (as a developer)

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

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser
@kentcdodds
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',