Skip to content

Instantly share code, notes, and snippets.

(defnctx-keys foo [db]
(update! db "foo")))
(defnctx app [_ (foo)])
(apply-ctx app (init-context))
@m0smith
m0smith / direader2.clj
Created April 17, 2014 01:29
Transform reader monad
(defn foo* [context]
(let [db (get context :db)]
(update! db "foo")))
(defn app* [context]
(let [_ (foo* context)]))
@m0smith
m0smith / direader.clj
Created April 17, 2014 01:13
Dependency Injection in Clojure 5.1 - Reader Monad
(defn foo []
(domonad reader-m [db (asks :db)]
(update! db "foo")))
(defn app []
(domonad reader-m [_ (foo)]))
((app) (init-context))
@m0smith
m0smith / diclosure.clj
Last active August 29, 2015 13:59
Dependency Injection in Clojure 4 - Closure
(defn wrap-context [context]
(let [db (:db context})]
(letfn [
(foo [] (update! db "foo"))
(app [] (foo))]
app)))
@m0smith
m0smith / diarg.clj
Last active August 29, 2015 13:59
Depedency Injection in Clojure 3 - Function Argument
(defn foo [context]
(let [db (:db context)]
(update! db "foo")))
(defn start-app [context]
(foo context))
(start-app (init-context))
@m0smith
m0smith / dibinding.clj
Created April 16, 2014 19:59
Dependency Injection in Clojure 2 - Binding
(def ^:dynamic *context* {})
(defn foo []
(let [db (:db *context*)]
(update! db "foo")))
(defn start-app []
(binding [*context* (init-context)]
(foo)))
@m0smith
m0smith / gist:10925790
Last active August 29, 2015 13:59
Dependency Injection in Clojure 1 - global (non-DI)
(def context (init-context))
(def foo []
(let [db (:db context)]
(update! db "foo")))
Feb 03, 2014 1:31:19 PM org.sonatype.guice.bean.reflect.Logs$JULSink warn
WARNING: Error injecting: org.apache.maven.model.io.DefaultModelReader
java.lang.NoClassDefFoundError: org/apache/maven/model/InputSource
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
at java.lang.Class.getDeclaredMethods(Class.java:1855)
at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:664)
at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:358)
at com.google.inject.internal.ConstructorBindingImpl.getInternalDependencies(ConstructorBindingImpl.java:155)
at com.google.inject.internal.InjectorImpl.getInternalDependencies(InjectorImpl.java:585)
@m0smith
m0smith / gist:8261464
Last active January 2, 2016 06:09
Error running ecb-activate using Version: 20131116.1319
Debugger entered--Lisp error: (error "ECB 2.40: Errors during the layout setup of ECB. (error-type: error, error-data: (\"Variable binding depth exceeds max-specpdl-size\"))")
signal(error ("ECB 2.40: Errors during the layout setup of ECB. (error-type: error, error-data: (\"Variable binding depth exceeds max-specpdl-size\"))"))
error("ECB %s: %s (error-type: %S, error-data: %S)" "2.40" "Errors during the layout setup of ECB." error ("Variable binding depth exceeds max-specpdl-size"))
ecb-clean-up-after-activation-failure("Errors during the layout setup of ECB." (error "Variable binding depth exceeds max-specpdl-size"))
ecb-activate--impl()
ecb-activate-internal()
ecb-minor-mode(1)
ecb-activate()
call-interactively(ecb-activate record nil)
command-execute(ecb-activate record)
@m0smith
m0smith / wkp_Delicious.php
Last active December 20, 2015 07:28
A Lionwiki plugin that will pull data from Delicious. The usage is {delicious}user/tag{/delicious}. See https://delicious.com/developers/rssurls
<?php
/*
* Written by Matthew O. Smith <m0smith@yahoo.com>
* With {delicious}user/tag{/delicious} insert links from the user and tags
* With {delicious}user/tag?count=50{/delicious} you can spcifiy the number of items returned
*/
class Delicious
{
var $desc = array(