Python Projects
-
Comber
Comber is a parser combinator library for creating text parsers in plain Python with a BNF flavor. While not quite powerful enough to implement a full-blown language with (under the hood it's a recursive-descent parser... with a bit of flair), it's more than enough to replicate a grammar out of an RFC to validate and extract data.
from comber import C, rs, inf key = rs(r'[_a-zA-Z][_a-zA-Z0-9]*')@('key') number = rs(r'[0-9]+')@('number', int) package = key[1, inf, ','] import_statement = C+ 'import' + package value = key | number function_call = key + '(' + value**',' + ')' assignment = C+ 'let' + key + '=' + (function_call | value) grammar = (import_statement | assignment | function_call)[0, inf]
-
Foamlr
Foamlr is an LR, shift-reduce style parser library. While less-flexible than a combinator-based parser like Comber, it can handle deeply recursive grammars and larger source texts than Comber. It also manages tokenization internally, which does have some potential for (a little) more flexibility than traditional, yacc-style parser generators.
from foamlr import Nonterminal, R, RECURSE, P integer = R('integer', '[0-9]+') arithmetic = Nonterminal('arithemtic') value = Nonterminal('value', integer, P* '-' * RECURSE, P* '(' * arithemtic * ')', ) multiplication = Nonterminal('multiplication', value * '*' * value, value * '/' * value, ) arithmetic.fill( multiplication * '+' * multiplication, multiplication * '-' * multiplication, ) parser = generate(arithmetic) parser.parseString("2 * (7 - 4)")
-
Restsh
Restsh is a shell-like command interpreter for working with RESTful (or REST-esque) remote services. You can easily make adhoc web calls and inspect and manipulate the results, or create a service definition for an API and use it like a first class object (as in the example below). Restsh sits in the middle of working with shell tools and writing a full script.
REST Shell Use the "help" command to get help, and "exit" to exit the shell. $ import outlook $ help outlook.setAuthentication outlook.setAuthentication is a function Replace the authentication data for this service. It takes 1 arguments: auth: string $ outlook.setAuthentication(auth: "eyJ0eXAiOiJKV1Q....") Service[outlook] $ let messages = outlook.getMessages(mboxId: "me@example.com") $ size(of: messages) 6 $ let getSender = \item. item.Sender.EmailAddress.Name $ let senders = map(arr: messages, fn: getSender) $ senders [ "Steven", "Molly", "Mark", "Target", "Louise", "Campaign for Better Times" ] $ exit
Web Projects
-
The "Doctor Who" Game
I grew up on the Atari ST, and one of the first games I ever played on it was called Daleks. It's a simple game: you move The Doctor around a grid-like game board, trying to avoid - and destroy - a hoard of daleks.
Not the sort of game likely to see a modern rerelease.
A decade ago I got the itch to play it again, and did the obvious: wrote my own version. That first version was made with Angular v1. I've recently updated it to React and Typescript. Both wild overkill for the task - but fun!
-
Widgy
Widgy is a simple HTML widget kit and framework that is built on modern browser features. Applications can be written in plain HTML and JavaScript without additional dependencies. It contains a data binding system similar to Knockout, but tries to leave as much as possible to the browser.
<html> <head> <script type="module"> import * as widgy from './widgy/widgy.js' class App extends widgy.Application{ constructor(){ super() this.addProperty('editableSelectValue', null) } } widgy.start(App) </script> </head> <body> <span>Editable select with inline options</span> <select selected="@<editableSelectValue" editable="true"> <option>foo</option> <option>bar</option> </select> <span>{editableSelectValue}</span> </body> </html>
-
Recipe Box
Personally, I want slightly more out of a recipe app than an ingredient list and a big text box for instructions. Recipe Box provides a reorderable ingredient list and instruction steps, automatically includes measurements in the instruction section, and syncs a local copy so you don't need to be online and logged in to view, edit, or create a recipe.
The site is made with Widgy, an Azure Function App written in Python, and Azure Blob storage (for the recipe data and images).
whoami
-
I'm a former founder and life-long software developer. I've got a fascination with how people interact with computers, especially us programmers. The programs we write are influenced by the languages, libraries, and APIs we have at our disposal — finding the right ones can be the difference between a well thought-out, testable system and a labyrinth of duct tape and cardboard.
-
Find Me Elsewhere