Skip to content

Instantly share code, notes, and snippets.

@austinyun
austinyun / gist:3525257
Created August 30, 2012 10:00
Stream API test
var http = require("http"),
oppressor = require("oppressor");
http.createServer(function (req, res) {
var s = oppressor(req);
s.end("OK, everything worked");
s.pipe(res);
}).listen(8080);
@austinyun
austinyun / gist:3243470
Created August 3, 2012 02:05
Array Iteration Interview Problem
var _ = require("underscore")._;
// No mutation version
function increment_where_pure(array, match, n) {
var count;
function iterator(f, acc, item) {
// f is the function used to combine array arguments -- push || unshift
if (count === 0) {
f.call(acc, item);
@austinyun
austinyun / gist:3027255
Created July 1, 2012 07:10
Javascript killing the syntax file
var http = require('http'),
fs = require('fs'),
utils = require('util'),
git = require('git-fs'),
path = require('path'),
router = require('choreographer').router();
module.exports = function rice() {
// Initialize git-fs with the cwd
@austinyun
austinyun / .vimrc
Created June 29, 2012 09:52
Make Vim Autoclose stop autoclosing apostrophes so you can quote things in lisps
" MAKE SURE you're using the updated/maintained version https://github.com/Townk/vim-autoclose
" and not the one just called AutoClose from vim.org, or this doesn't work.
" Check my vimrc for details ( http://github.com/austinyun/dotfiles/blob/master/.vimrc )
autocmd FileType lisp,clojure let b:AutoClosePairs = AutoClose#DefaultPairsModified("", "'")