Skip to content

Instantly share code, notes, and snippets.

Thomas Ballinger thomasballinger

Block or report user

Report or block thomasballinger

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 browserCanvasCtxFill.html
<canvas id="canvas1" width="200" height="200"></canvas>
<canvas id="canvas2" width="200" height="200"></canvas>
<canvas id="canvas3" width="200" height="200"></canvas>
var canvases = [canvas1, canvas2, canvas3]
var fillArgs = [undefined, 'evenodd', 'nonzero']
thomasballinger / Main.elm
Last active Aug 18, 2016
This type error goes away if I switch the order of lines 54 and 55
View Main.elm
module Main exposing (..)
type alias HasXAndY a =
{ a | x : Float, y : Int }
type alias HasX a =
{ a | x : Float }
from typing import Callable
class A: pass
class B: pass
class C: pass
def composition(aToB: Callable[[A], B],
bToC: Callable[[B], C]) -> Callable[[A], C]:
"""Returns a callable that takes an A and returns a C"""
View gist:f72c2a4ca5dba8d1b38db33458962ef1
a simple remix file format
Files are always UTF-8
a syntax like
episode <episode query> of <podcast url>
play from <time> to <time> [at 2x speed] [at +12 dB]
View justnumbers.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
thomasballinger / openedByPython.log
Created Feb 14, 2016
.py files opened by Python just to start up
View openedByPython.log
tomb@localhost:~$ strace python 2>&1 >/dev/null | grep open | grep -v ENOENT | grep -o '".*"' | grep -v '\.pyc'
import tty
import termios
import sys
class Cbreak(object):
def __enter__(self):
self.original_stty = termios.tcgetattr(sys.stdin)
tty.setcbreak(sys.stdin, termios.TCSANOW)
#!/usr/bin/env python
import socket
listener = socket.socket()
listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
listener.bind(('', 8000))
while True:
def preview(content):
import webbrowser
import tempfile
import time
with tempfile.NamedTemporaryFile(suffix='.html') as f:
import re
def tokenize(s):
>>> tokenize("(1.1 + 2 * 3)")
['(', '1.1', '+', '2', '*', '3', ')']
return re.findall("[0123456789.a-zA-Z]+|[*+/\-()=]", s)
You can’t perform that action at this time.