Skip to content

Instantly share code, notes, and snippets.

@tooxie
tooxie / index.html
Created September 14, 2013 09:42
toCamelCase
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>toCamelCase</title>
<script src="tail-tocc.js"></script>
<script src="loop-tocc.js"></script>
<script type="text/javascript">
@tooxie
tooxie / cls-example.js
Last active December 22, 2015 03:59 — forked from dazld/cls-example.js
continuation-local-storage example
var cls = require('continuation-local-storage-glue');
var http = require('http');
var uuid = require('uuid').v4;
var local = cls.createNamespace('reqNS');
http.createServer(function(req, res) {
req._id = uuid();
local.run(function() {
local.set('id', req._id);
next(req, res);
@tooxie
tooxie / resources.kolba.js
Last active December 22, 2015 02:28
Defining RESTful APIs with Kolba
var Kolba = require('kolba');
var app = new Kolba.App();
// RESTful
var lyricsResource = new Kolba.Resource({
get: function() {
// Fetch from somewhere
return json;
}
@tooxie
tooxie / domain.js
Last active December 21, 2015 00:48
var http = require('http');
var rid = 0;
var uuid;
var server = http.createServer(function(req, res) {
var domain = require('domain');
var reqd = domain.create();
var uuid = require('node-uuid').v1();
rid += 1;
@tooxie
tooxie / keep-calm-and-continue-rebasing.rst
Last active December 20, 2015 21:48
Keep calm and continue rebasing

Published to HN: https://news.ycombinator.com/item?id=5643342

Keep calm and continue rebasing

Quite recently an article calling to stay away from rebase was published, in which the author states that you should absolutely never rebase. Well... that's bullshit.

@tooxie
tooxie / gzip.py
Created March 21, 2013 17:10
Browsers can't handle this
from flask import Flask, Response
app = Flask(__name__)
@app.route('/')
def index():
return Response('{}', headers={'content-encoding': 'gzip'})