Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/config/security-config.xml
</param-value>
</context-param>
<!-- Enables Spring Security -->
(defn- stateful-memoize
[f #^java.util.Map map]
(fn [& args]
(if-let [e (find map args)]
(val e)
(let [ret (apply f args)]
(.put map args ret)
ret))))
(defn weak-memoize
Caused by: java.lang.NullPointerException
at clojure.core.protocols$fn__6000$G__5996__6004.invoke(protocols.clj:11)
at clojure.core$reduce__6111.invoke(core.clj:4719)
at clojure.core$destructure__4528$pb__4529$pmap__4532$fn__4533.invoke(core.clj:3006)
at clojure.core.protocols$fn__6011.invoke(protocols.clj:62)
at clojure.core.protocols$fn__6000$G__5996__6004.invoke(protocols.clj:11)
at clojure.core$reduce__6111.invoke(core.clj:4719)
at clojure.core$destructure__4528$pb__4529$pmap__4532.invoke(core.clj:3007)
at clojure.core$destructure__4528$pb__4529.invoke(core.clj:3021)
at clojure.core$destructure__4528$process_entry__4544.invoke(core.clj:3023)
(ns a)
(use '[clojure.contrib.io :only (make-parents spit delete-file)])
(use '[clojure.contrib.shell :only (sh)])
(use '[clojure.contrib.str-utils :only (re-split str-join)])
(defn- convert-fn-meta-into-javadoc
[impl-ns prefix mname pclasses rclass is-static?]
(let [m (meta (resolve (symbol (str (str impl-ns) "/" prefix (str mname)))))
{:keys [file line doc]} m
(reduce
(fn [m w]
(update-in m [w]
#(inc (or % 0))))
{}
(.split "a b a b c d d" "\\W+"))

If you were looking for clojure date-handling stuff, the code’s been moved here.

(ns com.snowtide.clojure.memoize)
(defn- mutable-memoize
[f #^java.util.Map map]
(fn [& args]
(if-let [e (find map args)]
(val e)
(let [ret (apply f args)]
(.put map args ret)
ret))))
(require 'clojure.string)
(defn- minify-css
"Because I've already got google closure working for the js, and don't want to
bother with YUI compressor too just for CSS."
[css]
(-> css
(clojure.string/replace #"[\n|\r]" "")
(clojure.string/replace #"\s+" " ")
(clojure.string/replace #"\s*:\s*" ":")
@cemerick
cemerick / gist:941517
Created April 26, 2011 00:08 — forked from stuarthalloway/gist:941069
Generic clojure encoding map for rummage
;; needs rummage to use as-set instead of as-collection...
(def clojure-encoding-map
(assoc enc/all-strings
:encode (fn encode
([k] (pr-str k))
([k v]
[(pr-str k) (pr-str v)]))
:decode (fn
([k] (read-string k))
([k v] [(read-string k) (read-string v)]))))
@cemerick
cemerick / scala_artifacts_in_repo.txt
Created June 30, 2011 10:30
.jar artifacts in Scala's repo
[catapult:/tmp] chas% git clone git://github.com/scala/scala.git
Initialized empty Git repository in /private/tmp/scala/.git/
remote: Counting objects: 173008, done.
remote: Compressing objects: 100% (34171/34171), done.
remote: Total 173008 (delta 122550), reused 171777 (delta 121423)
Receiving objects: 100% (173008/173008), 215.33 MiB | 1071 KiB/s, done.
Resolving deltas: 100% (122550/122550), done.
Checking out files: 100% (5550/5550), done.
[catapult:/tmp] chas% cd scala/
[catapult:/tmp/scala] chas% find . -name "*.jar" -print0 | xargs -0 du -ch