I hereby claim:
- I am mattmoss on github.
- I am mattmoss (https://keybase.io/mattmoss) on keybase.
- I have a public key ASBJyGO254oviU7KjO6BVBTiBpnO8T_ikM6Y7iWmej61XAo
To claim this, I am signing this object:
(defn gen-id-dispatch | |
[& args] | |
(let [n (count args)] | |
(cond | |
(= n 1) (class (first args)) | |
(= n 2) :pair | |
:else nil))) | |
(defmulti gen-id #'gen-id-dispatch :default nil) |
(defn- some-listener | |
[event-1 event-2 event-3] | |
(reify SomeListener | |
(onEvent1 [this x] (send event-1 (constantly x))) | |
(onEvent2 [this x] (send event-2 (constantly x))) | |
(onEvent3 [this x y] (send event-3 (constantly [x y]))))) | |
(defn make-thing | |
[] | |
(let [event-1 (agent nil) |
(defn test-agent-restart [] | |
(let [x (agent 0 :error-handler (fn [a ex] (println ex) (restart-agent a 0)))] | |
(println @x) | |
(send x inc) | |
(await x) | |
(println @x) | |
(send x (fn [_] (throw (Exception. "whatever")))) | |
(await x) | |
(println @x))) |
(defn inc-wrap | |
"increment with wraparound to 0; limit should be positive" | |
[x limit] | |
(if (< x limit) (inc x) 0)) | |
(defn handle-pool | |
[limit] | |
(ref {:next 0 :limit limit :in-use #{}})) | |
(defn- unique-handle |
;; Given two sequences (seq-a and seq-b) of equal length and corresponding | |
;; items, can one sequence be filtered according to a predicate function (pred?) | |
;; applied to the second? | |
(map second | |
(filter #(pred? (first %)) | |
(map list seq-a seq-b) |
(ns user (:require [conch.core :as sh])) | |
;; p is a process returned from (sh/proc ...) | |
(defn read-lines-until [p re] | |
(loop [line (sh/read-line p :out)] | |
(when line | |
(if-let [match (re-find re line)] | |
match | |
(recur (sh/read-line p :out)))))) |
(ns test.connection | |
(:require [clojure.test :refer :all] | |
[conch.core :as conch] | |
[conch.sh :as sh])) | |
(def ^:private process-name "./server.sh") | |
(def ^:private process-dir "/Users/mattmoss/samples/") | |
(def ^:private patt-server-url #"Server bound to (http://localhost:\d+)") |
import groovy.xml.MarkupBuilder | |
class Slideshow { | |
Map options | |
StringWriter writer = new StringWriter() | |
MarkupBuilder markup = new MarkupBuilder(writer) | |
boolean inGroup = false | |
boolean inSlide = false |
I hereby claim:
To claim this, I am signing this object:
module main | |
import os | |
fn glob(pattern string, text string) bool { | |
plen := pattern.len | |
tlen := text.len | |
mut p := 0 | |
mut t := 0 | |
mut np := 0 |