View vimrc
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
function! RunTests(filename) | |
" Write the file and run tests for the given filename | |
:w | |
if match(a:filename, '\.feature$') != -1 | |
:silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo | |
exec ":!bundle exec cucumber " . a:filename | |
elseif match(a:filename, '\.coffee$') != -1 | |
:silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo | |
exec "!jasmine-headless-webkit " . a.filename | |
else |
View datomic setup gist
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
empty-datomic-mem-db-setup | |
============================== | |
WARNING: Final GC required 5.030329259746849 % of runtime | |
Evaluation count : 322200 in 60 samples of 5370 calls. | |
Execution time mean : 204.316059 µs | |
Execution time std-deviation : 23.252812 µs | |
Execution time lower quantile : 185.144721 µs ( 2.5%) | |
Execution time upper quantile : 267.418129 µs (97.5%) | |
Overhead used : 1.833968 ns |
View err.clj
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
(deftype Failure [f]) | |
(defn unwrap-fail [^Failure fail] | |
((.f fail))) | |
(defn fail? [potential-fail] | |
(isa? (class potential-fail) Failure)) | |
;;TODO: extract into a new namespace, maybe an OS project? | |
(defmacro err->> |
View gist:167461
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
def woopfordocstrings(): | |
'''this is a docstring''' | |
print "sausages" |
View Text-munger.clj
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
; Answers http://www.rubyquiz.com/quiz76.html | |
(defn text-munger [string] | |
(for [word (re-split #"\s" string)] | |
(if (> (count word) 3) | |
(let [start (first word) | |
end (last word)] | |
(str start (reduce str (shuffle (drop 1 (take (- (count word) 1) word)))) | |
end)) word))) |
View clojure-mode-test-from-implimentation.el
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
(defun my-run-tests () | |
(interactive) | |
(let ((test-buffer (find-buffer-visiting (format "%stest/%s-test.clj" | |
(locate-dominating-file buffer-file-name "src/") | |
(file-name-nondirectory (file-name-sans-extension buffer-file-name)))))) | |
(save-buffer) | |
(with-current-buffer test-buffer | |
(clojure-test-run-tests)) | |
(sit 1) | |
(if |
View gist:276535
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
(defun flash-modeline (color) | |
(setq old-background-face (copy-face 'modeline 'old-background-face)) | |
(setq old-buffer-id-face (copy-face 'modeline-buffer-id 'old-buffer-id-face)) | |
(set-face-to-one-color 'modeline color) | |
(set-face-to-one-color 'modeline-buffer-id color) | |
(sit-for 1) | |
(set-face-background 'mode-line (face-background old-background-face)) | |
(set-face-foreground 'mode-line (face-foreground old-background-face)) | |
(set-face-background 'mode-line-buffer-id (face-background old-buffer-id-face)) | |
(set-face-foreground 'mode-line-buffer-id (face-foreground old-buffer-id-face)) |
View gist:277709
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
a Java array | |
agt an agent | |
coll a collection | |
expr an expression | |
f a function | |
idx an index | |
r a ref | |
v a vector | |
val a value | |
pred a predicate |
View string_calculator.clj
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 string_calculator | |
(:use clojure.contrib.str-utils)) | |
(defn add-numbers [s] | |
(reduce + (map #(check-num %) | |
(filter #(not= "" %) (re-split #"," s))))) | |
(defn check-num [i] | |
(let [intr (Integer. i)] | |
(if (> 0 intr) |
View xml quicksort
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
<xml> | |
<defun name="qsort"> | |
<args> | |
<required-arg name="lis" /> | |
<optional-args> | |
<optional-arg name="less" default="nil"/> | |
<optional-arg name="greater" default="nil"/> | |
</optional-args> | |
</args> | |
<cond> |
OlderNewer