This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(add-to-list 'load-path (expand-file-name "~/elisp/slime")) | |
(add-to-list 'load-path (expand-file-name "~/elisp/slime/contrib")) | |
(require 'slime) | |
(slime-setup '(slime-repl)) | |
(add-to-list 'load-path (expand-file-name "~/elisp/clojure-mode")) | |
(add-to-list 'load-path (expand-file-name "~/elisp/swank-clojure")) | |
(require 'clojure-mode) | |
(add-hook 'clojure-mode-hook 'aar/lispy-parens) | |
(load "swank-clojure") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% rlwrap java -jar clojure.jar | |
Clojure 1.2.0-master-SNAPSHOT | |
user=> (deftype Foo [] clojure.lang.IPersistentMap) | |
#'user/Foo | |
user=> (merge {} (Foo)) | |
java.lang.NullPointerException (NO_SOURCE_FILE:0) | |
user=> (merge (Foo) {}) | |
java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap (NO_SOURCE_FILE:0) | |
user=> ^D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user=> (defrecord Foo []) | |
user.Foo | |
user=> (Foo) | |
java.lang.Exception: Expecting var, but Foo is mapped to class user.Foo (NO_SOURCE_FILE:0) | |
user=> (defrecord Foo [bar baz]) | |
user.Foo | |
user=> (Foo 1 2) | |
java.lang.Exception: Expecting var, but Foo is mapped to class user.Foo (NO_SOURCE_FILE:0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java.lang.ClassCastException | |
[Thrown class java.lang.RuntimeException] | |
Restarts: | |
0: [QUIT] Quit to the SLIME top level | |
1: [CAUSE1] Invoke debugger on cause [Thrown class java.lang.ClassCastException] | |
Backtrace: | |
0: clojure.lang.LazySeq.sval(LazySeq.java:47) | |
1: clojure.lang.LazySeq.seq(LazySeq.java:56) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(do | |
(-> (java.io.File. "/tmp/foo/bar/baz") .mkdirs) | |
(-> (java.io.File. "/tmp/foo/bar") .list seq)) | |
;; => ("baz") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns foo.randomizer | |
(:use [clojure.test])) | |
(defn delete [coll idx] | |
(if (<= (inc idx) (count coll)) | |
(let [coll (vec coll)] | |
(concat (subvec coll 0 idx) (subvec coll (inc idx) (count coll)))) | |
coll)) | |
(defn randomize [coll] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-dss AAAAB3NzaC1kc3MAAACBAJKqbq7Ycql2sxAyA/XbuP3OOXZIpc9ttmaK7hmdVTweM+17K+FbPLE5eEeeNcmlWcCbNL1TbG8wRr5NfgxSe0lWOTyIhHp8S0jOHFAL8DFbcHD5d3YeuV8C/8Oa3Z54kcWgvQoeE6ZEuIi1HD3iX7xwSdF8X4ECKhObbk+a/M2jAAAAFQC+QBmBV8DBqtwpQt0D8awjc1ISRQAAAIAicoPYfvrSJMm1r8L9aluy7DwUbE8j4L7fyDzMqyFlHtEGSVHVuSGd4wIjej0XK+BXGbrgTpPmIR0yUSTLNUIPwAVdAuultkHTrEonxjmFV7xhZkjTJLCLFWv3/S3rcSIsTwTzI27mxR/bqlsXEjAddxmw7WCIftcFv9f8kuTjXQAAAIBXidiAyoHJIkovyvkKdZT6sXLraq6TiZu0L7ZQDHjCjrzZm4FHY/HNpEJkdPWQl/djgdWmMVgNXzr6QsrKvQzcgkM1M4zjrPrgJM/UNLD1UTbJqV3li5nkRuzkfSqndJmu4AYvRpLOzHCayaU8qlf59t3HOHK5d26cY9hdVN5zIQ== aar@packer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro join-path [& paths] | |
`(-> ~@(for [p paths] `(java.io.File. ~p)))) | |
user> (join-path "/foo///" "///bar" "/baz////") | |
#<File /foo/bar/baz> | |
user> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, json, functools, time | |
if sys.stdin.isatty(): | |
data = json.loads(file("/tmp/status").read()) | |
else: | |
data = json.loads(sys.stdin.read()) | |
bytes = 0 | |
docs = 0 | |
shardn = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
An XPath for JSON, modified by Drew Raines | |
A port of the Perl, and JavaScript versions of JSONPath | |
see http://goessner.net/articles/JsonPath/ | |
Based on on JavaScript version by Stefan Goessner at: | |
http://code.google.com/p/jsonpath/ | |
and Perl version by Kate Rhodes at: | |
http://github.com/masukomi/jsonpath-perl/tree/master |