Skip to content

Instantly share code, notes, and snippets.

View catharinejm's full-sized avatar
🐶

Catharine Manning catharinejm

🐶
View GitHub Profile
{
"name": "streamy",
"version": "0.0.1",
"dependencies": {
"most": "1.5.0"
},
"devDependencies": {
"@types/node": "^8.0.18"
}
}
@catharinejm
catharinejm / rlock.go
Last active May 26, 2017 14:33
A re-entrant lock with sync wrapper
package main
import (
"fmt"
"sync"
"sync/atomic"
"unsafe"
)
type Owner unsafe.Pointer
@catharinejm
catharinejm / evenodd.scala
Created September 22, 2016 01:20
Even/odd addition proof in scala
// See https://brianmckenna.org/blog/evenodd_agda_idris_haskell_scala
sealed trait Nat
trait Z extends Nat
case object Z extends Z
case class S[N <: Nat](n: N) extends Nat
sealed trait Even[N <: Nat]
trait EvenZ extends Even[Z]
case object EvenZ extends EvenZ
@catharinejm
catharinejm / squashtrouble.sh
Last active April 4, 2016 15:34
Trouble with squash merges
# Create a fresh repo
$ git init testsquash
Initialized empty Git repository in /Users/jon/Code/Sterf/testsquash/.git/
$ cd testsquash
# Commit a file to master
$ echo foo >> file
$ git add .
module Interpreter
import Data.Fin
import Data.Vect
data Ty = TyInt
| TyBool
| TyStr
| TyFun Ty Ty
@catharinejm
catharinejm / Concat.java
Created August 15, 2015 23:28
Clojure lazy concat without stack overflow
/**
* Copyright (c) Rich Hickey. All rights reserved.
* The use and distribution terms for this software are covered by the
* Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
* which can be found in the file epl-v10.html at the root of this distribution.
* By using this software in any fashion, you are agreeing to be bound by
* the terms of this license.
* You must not remove this notice, or any other, from this software.
**/
@catharinejm
catharinejm / clojure-setup.md
Last active August 29, 2015 14:21
Clojure Setup

Getting Clojure set up

Leiningen

Leiningen is the de facto clojure project and package manager. It can be installed via homebrew on OS X

brew install leiningen

or just download the shell script and put it on your path. If ~/bin is on your path, then you would do:

@catharinejm
catharinejm / coffee
Last active August 29, 2015 14:18
Coffeescript Nave shim
#!/usr/bin/env zsh
set -e
function nave_version_file {
file="$(pwd)/.nave-version"
if [ -f "$file" ]; then
echo "$file"
elif `git rev-parse &>/dev/null`; then
file="$(git rev-parse --show-toplevel)/.nave-version"
fs = require 'fs'
#request = require 'request'
#
request = ({uri}, done) ->
done null, uri
reqreq = (uris) ->
for uri in uris
yield ( (done) -> done null, uri )
@catharinejm
catharinejm / genseq.coffee
Last active August 29, 2015 14:16
genseq.coffee
isGen = (f) ->
f? and f.constructor.name is 'GeneratorFunction'
isIter = (f) ->
f? and f.constructor.name is 'GeneratorFunctionPrototype'
class Seq
constructor: (it) ->
if isGen it
@_it = it()