Instantly share code, notes, and snippets.

View virgil_refresh.clj
(ns virgil.repl
(:require [clojure.set :as set]
[clojure.tools.namespace.dir :as ctn-dir]
[clojure.tools.namespace.file :as ctn-file]
[clojure.tools.namespace.find :as ctn-find]
[clojure.tools.namespace.parse :as ctn-parse]
[clojure.tools.namespace.repl :as ctn-repl]
[virgil.compile :refer [compile-all-java]])
(:import java.io.File
java.util.Arrays))
View countries.txt
Kyrgyzstan
Cyprus
St Kitts & Nevis
Egypt
Chad
Marshall Islands
Myanmar, {Burma}
Netherlands
Switzerland
Czech Republic
View gist:91d330df7e98f25d23ab9e75cfb0d6eb
- redisplay_internal (C function) 19334 90%
- debug 19334 90%
- recursive-edit 15689 73%
- nrepl-client-filter 10656 50%
- nrepl--dispatch-response 10159 47%
- nrepl-log-message 9813 46%
- nrepl--pp 9800 46%
- nrepl--pp 9798 46%
- nrepl--pp 9712 45%
- nrepl--pp 9056 42%
View *CPU-Profiler-Report*
- redisplay_internal (C function) 3653 87%
- debug 3653 87%
- recursive-edit 3372 80%
- nrepl-client-filter 2894 69%
- nrepl--dispatch-response 2728 65%
- nrepl-log-message 2722 65%
- nrepl--pp 2698 64%
- nrepl--pp 2698 64%
- nrepl--pp 2597 62%
- nrepl--pp 2346 56%
View init.el
;; I recommend mapping to C-c M-k
(defun my-cider-reset-buffer ()
(interactive)
(cider-interactive-eval "(remove-ns (ns-name *ns*))")
(cider-load-buffer))
View gist:b76bfd3e0c44dcc6d454480366117231
$ lein ancient
clojure.lang.Compiler$CompilerException: java.lang.ClassNotFoundException: org.joda.time.ReadablePartial, compiling:(ancient/ancient_clj/v0v3v13/clj_aws_s/v0v3v10/clj_time/v0v6v0/clj_time/core.clj:1:1)
at clojure.lang.Compiler.load (Compiler.java:7391)
clojure.lang.RT.loadResourceScript (RT.java:372)
clojure.lang.RT.loadResourceScript (RT.java:363)
clojure.lang.RT.load (RT.java:453)
clojure.lang.RT.load (RT.java:419)
clojure.core$load$fn__5677.invoke (core.clj:5893)
clojure.core$load.invokeStatic (core.clj:5892)
clojure.core$load.doInvoke (core.clj:5876)
View pmapn.clj
(require '[clojure.contrib.seq-utils :refer [indexed]])
(import (java.util.concurrent Executors ConcurrentHashMap))
(defn pmapn [n f coll]
(let [executor (Executors/newFixedThreadPool n)
total (count coll)
results (ConcurrentHashMap. total 0.75 n)]
;; enqueue work
(doseq [[i x] (indexed coll)]
(.execute executor #(.put results i (f x))))
View funhtml.js
/**
* Functional HTML library.
* Requires $ and _.
*/
(function(outerScopeObj) {
function toHTML(x) {
if (x.toHTML) {
return x.toHTML();
View fastrepl.sh
#!/bin/bash -e
if [ ! -f ./project.clj ]; then
echo "Run from a lein project directory."
exit 1
fi
mkdir -p ./.fastrepl/
if command -v md5 >/dev/null 2>&1; then
MD5=`md5 -q project.clj`