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
(require '[clojure.java.io :as io] | |
'[clojure.main :as m] | |
'[clojure.test :as test]) | |
(defn run-matching-tests | |
"(re)loads and runs tests under dir/ which match your regex, | |
useful for running all tests under a specific prefix | |
or containing a common name element like \"integration\"" | |
([match] | |
(run-matching-tests match "test/" false)) |
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 user | |
(:require [clojure.test :as test])) | |
(defmacro lf | |
[f] | |
(load-file (str "/tmp/" (str f) ".clj"))) | |
(defmacro l | |
[f] | |
`(lf ~(str "/clj-tmp-files/" f))) |
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
(ins)user=> (ns foo.bar (:refer-clojure :rename {map pam})) | |
nil | |
(ins)foo.bar=> (pam inc [1 2 3]) | |
(2 3 4) |
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=> (ns foo.broken) | |
nil | |
foo.broken=> (require 'circleci.test 'clojure.test) | |
nil | |
foo.broken=> (defn foo [] {:pre [false]} true) | |
#'foo.broken/foo | |
foo.broken=> (clojure.test/deftest foo-test (foo)) | |
#'foo.broken/foo-test | |
foo.broken=> (circleci.test/run-tests 'foo.broken) | |
test-results-dir: target/test-results |
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 org.noisesmith.agreeable | |
(:require [clojure.core.async :as >] | |
[clojure.core.async.impl.protocols :as >proto] | |
[clojure.core.async.impl.channels :as >chan]) | |
(:import (clojure.lang Var))) | |
(deftype CancelableThreadChan [future-task channel] | |
>proto/ReadPort | |
(take! [this fn1-handler] | |
(>proto/take! channel fn1-handler)) |
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
(defn download | |
; adapted from https://stackoverflow.com/a/3665147 | |
[data filename encoder] | |
(let [el (.createElement js/document "a") | |
data-str (js/encodeURIComponent (encoder data))] | |
(doto el | |
(.setAttribute "href" (str "data:text/plain;charset=utf-8," | |
data-str)) | |
(.setAttribute "download" filename)) | |
(aset (.-style el) "display" "none") |
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 vararg | |
[method object & args] | |
(let [[regular [_ t & variable]] (split-with #(not= % '|) args)] | |
`(. ~object ~method ~@regular (into-array ~t ~(vec variable))))) | |
#'user/vararg | |
=> (macroexpand-1 '(vararg get java.nio.file.Paths "foo" | String "bar" "baz")) | |
(. java.nio.file.Paths get "foo" (clojure.core/into-array String ["bar" "baz"])) | |
=> (vararg get java.nio.file.Paths "foo" | String "bar" "baz") | |
#object[sun.nio.fs.UnixPath 0x14ebb640 "foo/bar/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
justin@S: ~/.config-git/deleteme/deleteme$ lumo -c ~/.m2/repository/andare/andare/0.5.0/andare-0.5.0.jar | |
Lumo 1.1.0 | |
ClojureScript 1.9.456 | |
Docs: (doc function-name-here) | |
Exit: Control+D or :cljs/quit or exit | |
cljs.user=> (require-macros '[cljs.core.async.macros :as >>]) | |
nil | |
cljs.user=> (require '[cljs.core.async :as >]) | |
nil |
NewerOlder