- workflow
$ heroku pg:psql -a isis-db
\d
\d+
| ;;; XML parsing and clojure.zip | |
| ;;; There's got to be a cleaner way to do this. | |
| ;;; I have code like this: | |
| (defn jdks-loc [xml-zipper] | |
| (zip/down | |
| (first | |
| (filter #(let [n (zip/node %)] |
| (ns resource | |
| "Automatic resource cleanup." | |
| (:import (java.lang.ref ReferenceQueue PhantomReference))) | |
| (def ^:private queue (ReferenceQueue.)) | |
| (def ^:private cleanup-fns {}) | |
| (defn resource | |
| "Returns a reference to x. At some point after the reference is |
| (defn subscriber-seq | |
| [ch qname] | |
| (let [[message-seq put] (pipe)] | |
| (letfn [(message-handler [ch msg-meta payload]) | |
| (put {:ch ch :msg-meta msg-meta :payload payload})] | |
| (lc/subscribe ch qname message-handler :auto-ack true)) | |
| message-seq)) | |
| (defn payload-str | |
| [x] |
| (let [[message-seq put] (pipe)] | |
| (letfn [(message-handler [ch msg-meta payload]) | |
| (put {:ch ch :msg-meta msg-meta :payload payload})] | |
| (lc/subscribe ch qname message-handler :auto-ack true)) | |
| message-seq) | |
| (let [[message-seq put] (pipe)] | |
| (letfn [(message-handler [ch msg-meta payload] | |
| (put {:ch ch :msg-meta msg-meta :payload payload}))] | |
| (lc/subscribe ch qname message-handler :auto-ack true)) |
| (defprotocol ToClojure | |
| (to-clojure [x])) | |
| (extend-protocol ToClojure | |
| List (to-clojure [xs] (map to-clojure xs)) | |
| RecommendedItem (to-clojure [x] {:item (.getItemID x) | |
| :value (.getValue x)})) |
| (def conv-table (sorted-map 1 :I | |
| 4 :IV | |
| 5 :V | |
| 9 :IX | |
| 10 :X | |
| 40 :XL | |
| 50 :L | |
| 90 :XC | |
| 100 :C | |
| 400 :CD |
| (defn maybe-word | |
| [s] | |
| (if (= "" s) [] [s])) | |
| (defprotocol WordState | |
| (append-chunk [this chunk] "Append a chunk to current word state") | |
| (append-segment [this segment] "Append a segment to current word state") | |
| (to-word-list [this] "Returns the state as a list of words")) |
| (ns example.net | |
| (:require [goog.net.WebSocket] | |
| [goog.events :refer (listen)] | |
| [cljs.core.async :as async :refer (chan <! >! put! close)] | |
| [cljs.core.async.impl.protocols :as proto]) | |
| (:require-macros [cljs.core.async.macros :refer (go)])) | |
| (defn ws | |
| "WebSocket as a core.async channel | |
| returns a channel which delivers the ws chan then closes" |
| (ns parse.core | |
| (:require [instaparse.core :as insta])) | |
| (def parser | |
| (insta/parser | |
| "sexp = lparen operation rparen | |
| <lparen> = <'('> | |
| <rparen> = <')'> | |
| operation = operator + args | |
| operator = '+' |