Skip to content

Instantly share code, notes, and snippets.

View hlship's full-sized avatar

Howard M. Lewis Ship hlship

View GitHub Profile
@hlship
hlship / build.gradle
Created February 20, 2014 16:28
Overriding transitive dependency versions
def versionOverrides = [
"asm:asm": "3.3.1",
"bultitude:bultitude": "0.1.7",
"commons-codec:commons-codec": "1.7",
"commons-io:commons-io": "2.4",
"io.aviso:pretty": "0.1.9-SNAPSHOT",
"joda-time:joda-time": "2.1",
"org.clojure:core.incubator": "0.1.1",
"org.clojure:tools.macro": "0.1.1",
"org.clojure:tools.namespace": "0.1.1",
### Keybase proof
I hereby claim:
* I am hlship on github.
* I am hlship (https://keybase.io/hlship) on keybase.
* I have a public key whose fingerprint is 2640 6BB1 AA04 110E 49AA 8671 A820 90FF 7CC1 9136
To claim this, I am signing this object:
@hlship
hlship / Eliminate C3P0 System.err output
Created April 21, 2014 15:17
C3P0 tends to spit out some debugging information at startup. This offends me. I found a way to stop it.
;;; This is a hook for C3P0 to get rid of some garbage it logs to System.err on startup.
(let [err System/err]
(try
(System/setErr (PrintStream. (NullOutputStream.)))
(Class/forName "com.mchange.v2.c3p0.cfg.C3P0Config")
(finally
(System/setErr err))))
(defrecord ConnectionManager [execution-mode active-connections databases]
component/Lifecycle
(start [component] ...)
(stop [component] ...))
(defprotocol State (state [this]))
(defrecord StateImpl [state-value]
State
(state [this] (:state-value this)))
(defprotocol State (state [this]))
(defrecord StateImpl [state-value]
State
(state [this] state-value))
(-> (StateImpl. 42) state)
=> 42
@hlship
hlship / gist:226c5830262ccbfab556
Created June 18, 2014 00:23
Not So Simple - Example for Threaded Conversation by Chris Conley - Updated for Version 5 (and Inform 6L02)
"Not So Simple"
Include Threaded Conversation by Chris Conley.
Section 1 - Model world
When play begins:
say "It is a long and riotous evening, full of unlikely stories and tall tales. But now most of the patrons have gone away to their rooms to sleep, or have passed out before the fire. Even the two black bitch pups are curled on the hearth-stone, snuffling through tiny wet noses, and pawing the air in sleep. Now is the time to find out whether the rumors that brought you to this neighborhood are true."
The Inn is a room. "The light is low and red. Above the fireplace hangs a map of this part of the Empire, and on the adjacent wall is the crimson and silver banner of Richard the Rose."
(defn next-payment-code
[db state]
(loop []
(let [initial @state
[[code new-state] (generate-payment-code db initial)]
(if (compare-and-set! state initial new-state)
code
(recur)))))
:omit-source true
:aot :all
:profiles {:client {:name "client" :main fan.client.main}}
(defproject io.aviso/fan "0.0.1"
:aliases {"ci-build" ["with-profile" "ci-build,dev" "spec" "--reporter=xml" "--reporter=documentation" "--no-color"]}
:dependencies [[org.clojure/clojure "1.6.0"]
;; configuration
[io.aviso/tracker "0.1.0" :exclusions [org.clojure/tools.logging]]