Skip to content

Instantly share code, notes, and snippets.

jml / HelloTests.swift
Last active Sep 10, 2018
swift test on macOS 10.13.6 (17G65)
View HelloTests.swift
import XCTest
class HelloTests : XCTestCase {
func testSimple() throws {
XCTAssertEqual(2, 1 + 1)
View time_test.go
package main
import (
View gist:45749e849d9058811672738057e01889
$ brew install emacs-mac --with-emacs-icons-project-EmacsIcon9 --with-gnutls
Checking out v1.0.1 in /usr/local/Homebrew...
To checkout master in /usr/local/Homebrew run:
'cd /usr/local/Homebrew && git checkout master
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
No changes to formulae.
==> Installing emacs-mac from railwaycat/emacsmacport
==> Downloading
jml /
Last active Aug 25, 2018
Things I want in Protolude

Stephen Diehl's protolude library is excellent. I highly recommend it as a default prelude for Haskell.

It's so good and so close to what I want that whenever I do come across something missing it's as obvious as a glitch in good music.

Here's what I'd like:


(<<$>>) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
View gtd.rst

GTD: tl;dr


  • A system must be reliable to be useful
    • Must have all of the things you care about
jml /
Last active Feb 10, 2016
Deferred equivalent of sleep?
def waitFor(clock, delay, deferred):
waitFor(reactor, 20, d).addCallback(print)
Will wait for 20s before calling ``print`` with the result of ``d``.
# H/T @tomprince
return deferred.addCallback(lambda x: deferLater(clock, delay, lambda: x))
jml / runtest.rst
Last active Feb 11, 2016
Class decorator instead of base TestCase
View runtest.rst

Some notes on a different approach to xUnit style tests. I don't necessarily want to implement it—I don't quite have the motive or opportunity—but I think it interesting enough to share.

Instead of telling users to subclass testtools.TestCase, we would tell them to decorate. Tests would look like:

class MyTests(object):
    def setUp(self):
        # no upcall
    def test_foo(self):
from twisted.trial.unittest import SynchronousTestCase
from twisted.internet.defer import gatherResults, maybeDeferred
class MyTests(SynchronousTestCase):
def test_catches_failure(self):
d = maybeDeferred(lambda: 1/0)
View Puzzle.hs
parts s = do
a <- [1..s-1]
b <- [1..s-a]
c <- [1..s-a-b]
d <- [1..s-a-b-c]
return [a, b, c, d]
jml / gist:e55dee21b5d4708ffca0
Created Jan 18, 2016
Ubuntu 14.04 LTS on ec2
View gist:e55dee21b5d4708ffca0
$ ssh ubuntu@
The authenticity of host ' (' can't be established.
RSA key fingerprint is 69:05:36:51:18:6a:ca:89:65:62:d4:a0:33:b5:6f:db.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (RSA) to the list of known hosts.
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-48-generic x86_64)
* Documentation:
System information as of Mon Jan 18 13:47:09 UTC 2016