Skip to content

Instantly share code, notes, and snippets.

@t-mw
t-mw / ErlangEUnit.sublime-snippet
Last active July 17, 2016 09:33
Sublime snippets
<snippet>
<content><![CDATA[${1:test_name}_(${2:_State}) ->
{"${3:description}",
fun() ->
${4:ok}
end}.]]></content>
<tabTrigger>eunit</tabTrigger>
<scope>source.erlang</scope>
<description>EUnit Test Case</description>
</snippet>
@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)
@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 / interact.bash
Last active April 16, 2016 15:08
interact.bash
# make commands interactive, essentially a bash version of http://thorstenball.com/fzz/.
# to use, copy to ~/.bash_profile or similar. requires ncurses.
# e.g. for an interactive `git grep`:
# interact git grep {{}} | ...
interact() {
# for printing ui create fd pointing to tty,
# in case stdout is redirected
exec 3> /dev/tty
@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);