Tuple

Here's a quick and mostly-decent ES6 Tuple type. class Tuple { get arity () { return Object.keys(this).length; } constructor (...params) { params.forEach((item, index) => Object.defineProperty(this, index, { enumerable: true, value: params[index] })); Object.freeze(this); } toString () { return "[Tuple " + Object.keys(this).map(k => `${k}:${this[k].toString()}`).join…

RethinkDB Connection Middleware

I needed to add a per-request RethinkDB connection to an Express app I was writing. Here's a piece of Express 4.x middleware which does that and cleans-up after itself: var r = require('rethinkdb'); module.exports = function (opts) { opts = opts || {}; opts.propName = opts.propName || 'db'; return function (req, res, next…

PEG.js Left Recursion

Sometimes it would be really easy to represent a rule using a Left-Recursive rule. For example: MemberExpression = object:MemberExpression '.' property:Identifier { return memberExpression(object, property, false); } Unfortunately PEG.js doesn't do LR grammars but there's actually a rather elegant solution when you rethink the problem: MemberExpression = object:Identifier…

Kana

In trying to learn a foreign syllabary a lot of learning methods are useless and sometimes you just need to learn it by rote. I've been struggling to learn the Japanese syllabaries: hiragana (平仮名) and katakana (片仮名) while trying to maximise what little time I have to learn Japanese. Necessity is the…

ES6 async/await

tl;dr: just like async/await and Tasks in C#, Promises in ES6 can allow us to have synchronous-looking asynchronous code and forever kill callback hell. In ES6 Promises are a way of handling asynchronous operations without needing to use traditional callback-style code. For example take this contrived node example…

Atom

Just earlier this week GitHub released a rather interesting piece of software called Atom, yet another text editor. Because everything is a remix, you could say Atom is a cross between Sublime Text (ST) and Adobe's Brackets. Wow, this is just like sublime. One of the major criticisms leveled against…

RoutieSPA

In this world of all-singing, all-dancing client-side MV* frameworks it's easy to over complicate things. Sometimes you need to rethink the problem and use appropriate technology which does just what you need it to. For example, say I have a simple Single-Page Application (SPA) to build. Each view corresponds…

2013 Retrospective

2013 turned out to be a busier year than usual. Got Married Became a resident of a foreign land Quit being a contract software developer Found a decent job Left a decent job Developed a lightly-popular syntax tool Found a great job Saw a new City Wife got sick Got…

Join the Compiler Creation Club

So you want to write your own programming language? Welcome to the world of compilers. Writing your own compiler can be a very rewarding process and in this article we'll be covering three areas at a fairly brusque pace: go over a little bit of language and compiler theory (§…

Hyperglot 0.1.0

So aside from a few minor inconveniences, bugs and features I think Hyperglot is almost complete now. At least, it does what I need it to do. tl;dr: Supports multiple projects of work Majorly refactored (maintainable, speedier) Nicer UI by a bit in various places Better compiler output including…

Language Hacking with Hyperglot

So I discovered PEG.js a few weeks ago and I was instantly smitten writing my own toy languages. Lispy things, pythonic things, all kinds of things. The demo is pretty good for playing around with things but after a while it's fairly constrictive when I want my grammar to…

Pareto CMS

So for a while now I've been trying to get around to creating a new website for myself. Like any creative, you sometimes need to scratch your own itch and build something for yourself. This website is a rolling development of a piece of software I'm calling Pareto: The Pareto…

AppHarbor goes mobile with HarborApp

This post originally appeared on my former business site. It is reproduced here for posterity. A few weeks ago, we decided to quickly mockup an AppHarbor app for iOS and today it's been released into the wild. From the HarborApp website: Harbor uses the AppHarbor API, allowing you to view…

Cloudlab / Launch Lessons

This post formerly appeared on the Cloudlab Blog. Cloudlab was a SAAS product that failed to get traction and wound-up in June '12. It is reproduced here for posterity. Since launching cloudlab we've gathered a wealth of lessons on what to do (and not to do). In this update, we're…

Cloudlab / Launch Announcement

This post formerly appeared on the Cloudlab Blog. Cloudlab was a SAAS product that failed to get traction and wound-up in June '12. It is reproduced here for posterity. After many months of work, but we're ready to unveil our cloudlab.io alpha! Cloudlab is a numerical processing environment built…