Skip to content

Instantly share code, notes, and snippets.

Matthew O. Smith m0smith

Block or report user

Report or block m0smith

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@m0smith
m0smith / diclosure.clj
Last active Aug 29, 2015
Dependency Injection in Clojure 4 - Closure
View diclosure.clj
(defn wrap-context [context]
(let [db (:db context})]
(letfn [
(foo [] (update! db "foo"))
(app [] (foo))]
app)))
@m0smith
m0smith / diarg.clj
Last active Aug 29, 2015
Depedency Injection in Clojure 3 - Function Argument
View diarg.clj
(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 Apr 16, 2014
Dependency Injection in Clojure 2 - Binding
View dibinding.clj
(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 Aug 29, 2015
Dependency Injection in Clojure 1 - global (non-DI)
View gist:10925790
(def context (init-context))
(def foo []
(let [db (:db context)]
(update! db "foo")))
View gh-56-stack-trace
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 Jan 2, 2016
Error running ecb-activate using Version: 20131116.1319
View gist:8261464
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 Dec 20, 2015
A Lionwiki plugin that will pull data from Delicious. The usage is {delicious}user/tag{/delicious}. See https://delicious.com/developers/rssurls
View wkp_Delicious.php
<?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(
@m0smith
m0smith / gist:6083731
Created Jul 25, 2013
Stack Trace from Archiva
View gist:6083731
javax.servlet.ServletException: javax.jdo.JDODataStoreException: Insert request failed: INSERT INTO JDOAUTHENTICATIONKEY (DATE_CREATED,PURPOSE,MODEL_ENCODING,DATE_EXPIRES,FOR_PRINCIPAL,AUTHKEY) VALUES (?,?,?,?,?,?)
NestedThrowables:
SQL Exception: An SQL data change is not permitted for a read-only connection, user or database.
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)
View rps.clj
(require 'clojure.core.async :refer :all)
(def MOVES [:rock :paper :scissors])
(def BEATS {:rock :scissors, :paper :rock, :scissors :paper})
(defn rand-player
"Create a named player and return a channel to report moves."
[name]
(let [out (chan)]
(go (while true (>! out [name (rand-nth MOVES)])))
View broken-refer.clj
(ns topoged.tt
(:require [clj-time.core :refer [epoch]]))
(epoch)
You can’t perform that action at this time.