Skip to content

Instantly share code, notes, and snippets.

@t-mw
t-mw / static_server.js
Last active March 11, 2016 09:13 — forked from ryanflorence/static_server.js
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@t-mw
t-mw / nginx-cors.conf
Created April 24, 2016 10:34 — forked from algal/nginx-cors.conf
nginx configuration for CORS (Cross-Origin Resource Sharing), with an origin whitelist, and HTTP Basic Access authentication allowed
#
# A CORS (Cross-Origin Resouce Sharing) config for nginx
#
# == Purpose
#
# This nginx configuration enables CORS requests in the following way:
# - enables CORS just for origins on a whitelist specified by a regular expression
# - CORS preflight request (OPTIONS) are responded immediately
# - Access-Control-Allow-Credentials=true for GET and POST requests
@t-mw
t-mw / app.js
Created May 16, 2016 12:11 — forked from mjackson/app.js
Using webpack with pixi.js
var PIXI = require('pixi.js')
console.log(PIXI)