Skip to content

Instantly share code, notes, and snippets.


David Chambers davidchambers

View GitHub Profile
View clean-diff.diff
var alib = require('alib');
var blib = require('blib');
var clib = require('clib');
+var zlib = require('zlib');
var fruits = [

Keybase proof

I hereby claim:

  • I am davidchambers on github.
  • I am davidchambers ( on keybase.
  • I have the public key with fingerprint CC3A 9C98 F8FA 1729 D1ED  C345 1625 E2CF 0BD0 FE42

To claim this, I am signing this object:

davidchambers / Makefile
Created Mar 8, 2014
Exclude files with "doctest ignore" in first line when running doctests
View Makefile
DOCTEST = node_modules/.bin/doctest --module commonjs
.PHONY: test
test: JS_FILES = $(shell find . -name '*.js' -not -path './node_modules/*' -not -path './test/*')
@$(foreach file,$(JS_FILES),head -n 1 -- $(file) | grep --silent 'doctest ignore' - || $(DOCTEST) $(file) || exit 1;)
davidchambers / DETAILS
Last active Aug 29, 2015
Single-Set Constructed (Teams)
9am, Sunday 15 June 2014 (NZ time)
Level 2
5 High Street
Auckland 1010
View Match.purs
findX :: (MatchObj -> Maybe MatchObj) -> [String] -> Maybe MatchObj
findX matcher words = head xs
xs = do len <- length words .. 1
idx <- 0 .. length words - len
let m = matcher { before: take idx words
, group: (drop idx >>> take len) words
, after: drop (idx + len) words
, matches: defaultTransaction
, context: []

Function composition has one huge benefit over chaining APIs: it allows any combination of JavaScript functions to be stuck together to form a pipeline. One could create a pipeline involving a function from library A, a function from library B, a function from library C, and a built-in function. With a chaining API one is restricted to the set of functions available on the object facilitating the chaining.

I found this to be a problem when using Underscore. This would be fine for a pipeline comprised solely of Underscore functions (represented here by lower-case identifiers):



Player Points
David 9
Darryn 6
Matt 3
Koray 3

Round 1

davidchambers / open_in_hashify.rb
Created May 15, 2011 — forked from adrusi/open_in_hashify.rb
TextMate command to open a markdown document in
View open_in_hashify.rb
#!/usr/bin/env ruby
require "base64"
message = "HG: Enter commit message. Lines beginning with 'HG:' are removed."
data =
data.gsub!(/^HG: .+\n/, '') if data.include? message
%x[open{Base64.encode64(data).gsub(/\n/, '')}]
+-[ COMMAND SETTINGS ]------------+
davidchambers / io.js
Last active Sep 26, 2015
Sketch of possible (synchronous) IO and AsyncIO types in JavaScript
View io.js
'use strict';
const fs = require('fs');
const R = require('ramda');
const S = require('sanctuary');
// unit :: ()
const unit = void 0;
View Javascript.seestyle
<?xml version="1.0" encoding="UTF-8"?>
<mode id="SEEMode.Javascript">
<style id="_Default"
color="#657b83" font-style="normal" font-weight="normal" background-color="#fdf6e3" />
<style id="/Javascript/Keywords"
color="#859900" font-style="normal" font-weight="normal" />
<style id="/Javascript/this"
color="#586e75" font-style="normal" font-weight="normal" />
<style id="/Javascript/Numbers"