Skip to content

Instantly share code, notes, and snippets.

#!/bin/env python
import sys
import re
from argparse import ArgumentParser
WORD_SPLIT = re.compile('[^a-zA-Z0-9]+')
FIRST_ALPHA = re.compile('^[a-zA-Z]')
def render(args,typename,values):
ericgj / Main.elm
Created Mar 6, 2018
session example
View Main.elm
type Page
= Search Page.Search.Model
type alias Model =
{ page : Page
, session : Session
type Msg
ericgj /
Last active Feb 27, 2019
sequencing tasks in dramatiq
import dramatiq
def sequence(environ, sequence, environ_key=None, result_key=None):
""" could be anything, just used to kick off a sequence """
return {
u'environ': environ,
u'count': len(sequence)
ericgj / Main.elm
Last active Jan 9, 2017
messy page update chains
View Main.elm
-- update triggered by browser URL change
updatePage : Pages.Page -> Model -> (Model, Cmd Msg)
updatePage page model =
(valueTypesStatus, valueTypesTask) =
if isLoadedValueTypes model then
( model.valueTypes
View Validation.elm
module Validation
( ValidationResult(..)
, map, mapMessage, andThen, andMap, succeed
, withDefault
, fromMaybeInitial, fromMaybe, toMaybe
, fromResultInitial, fromResult
, toString, message, isValid, isInvalid
, validate
View AutocompleteIDList.elm
module AutocompleteIDList exposing (..)
Adapted from
**Work in Progress**
Note that the underlying items must be `List (id,item)`
and `selectedItem` is `Maybe id` .
View form.elm
import Html exposing (Html, div, button, text)
import Html.Attributes as Attr
import Html.Events as Evt
import Html.App exposing (beginnerProgram)
import Html.Events exposing (onClick)
import Json.Decode as Json
import String
sample : Person
ericgj /
Last active Jun 18, 2018
simple tagged union type matching in python
Derived from []( function 'curried'
Amended to fix wrapping error: cf.
Copyright 2013 Alexey Kachayev
Under the Apache License, Version 2.0
ericgj /
Last active May 23, 2016
tmux open session/window for project
#!/usr/bin/env sh
# loosely based on http://pastebin/D8y7prYV, except with windows not sessions
if [ ${#} -eq 3 ]; then
echo "You need to provide both a session and path" 2>&1
exit 1