Skip to content

Instantly share code, notes, and snippets.

Eric Gjertsen ericgj

Block or report user

Report or block ericgj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gen-elm-enum-module.py
#!/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
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
ericgj / actor.py
Last active Feb 27, 2019
sequencing tasks in dramatiq
View actor.py
import dramatiq
@dramatiq.actor
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
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 =
let
(valueTypesStatus, valueTypesTask) =
if isLoadedValueTypes model then
( model.valueTypes
View Validation.elm
module Validation
exposing
( 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 https://github.com/thebritican/elm-autocomplete/blob/master/examples/src/AccessibleExample.elm
**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
ericgj / f.py
Last active Jun 18, 2018
simple tagged union type matching in python
View f.py
"""
Derived from [fn.py](https://github.com/kachayev/fn.py) function 'curried'
Amended to fix wrapping error: cf. https://github.com/kachayev/fn.py/pull/75
Copyright 2013 Alexey Kachayev
Under the Apache License, Version 2.0
http://www.apache.org/licenses/LICENSE-2.0
"""
@ericgj
ericgj / dev.sh
Last active May 23, 2016
tmux open session/window for project
View dev.sh
#!/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
fi
sess=${1}
View db-migrations-diary.md
You can’t perform that action at this time.