Skip to content

Instantly share code, notes, and snippets.

View jneen's full-sized avatar

Jeanine Adkisson jneen

View GitHub Profile
\makeatletter
\newwrite\shellout@out
\def\shellout@writeout@start#1{%
\begingroup
\immediate\openout\shellout@out#1%
\let\do\@makeother\dospecials%
\catcode`\^^M\active%
\def\verbatim@processline{%
\immediate\write\shellout@out{\the\verbatim@line}}%
#!/bin/bash
blanking() {
local mode="$1"; shift
case "$mode" in
-|stop) xset -dpms; xset s off ;;
+|start) xset +dpms; xset s on ;;
sus|suspend)
wake-loop &
ensure kill $!
open Batteries.Printf
open Batteries
type 't tokstate = Start | Tok of 't | Err of string | Eof
type 't state = {
mutable index : int ;
mutable head : 't tokstate ;
mutable behind : 't tokstate list ;
mutable ahead : 't tokstate list ;
var Dynamic = function() {
var context = {}
var defaults = {}
function bind(name, val, fn) {
try {
var save = context[name];
context[name] = val;
var out = fn();
}
> time node ~/tmp/perf-test.js
dynamic
real 0m0.697s
user 0m0.690s
sys 0m0.013s
> time node ~/tmp/perf-test.js static
static
@jneen
jneen / monad.py
Last active December 23, 2015 09:49
class Monad:
@staticmethod
def unit(val):
raise NotImplemented
def bind(self, fn):
raise NotImplemented
def map(self, map_fn):
"""
@jneen
jneen / monad.java
Last active December 20, 2015 11:39
// what i assume the callbacks look like
abstract class Callback<T> {
abstract void run(T data);
}
// the binding function a -> m b
abstract class Step<T, U> {
abstract Action<U> into(final T data);
}
@jneen
jneen / iter.hs
Last active December 19, 2015 02:09
iter [] step out = out
iter (x:xs) step out = do
val <- x
step val (iter xs out)
@jneen
jneen / testy.sh
Last active December 16, 2015 19:22
#!/bin/bash
echo == example the first ==
f1() {
local v=1
echo f1: $v
f2
}
#!/bin/bash
usage() {
cat <<EOF
Usage:
$0 [-r|--recursive] <fname>
$0 [-h|-?|--help]