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
#!/bin/sh | |
# vars | |
## EDITOR/VISUAL - what process to use to pick targets interactively | |
## ZK_WL - regex for zookeeper paths not to remove | |
## KAFKA_WL - regex for kafka topics not to remove | |
## MONGO_WL - regex for mongo item ids not to remove | |
# set -x |
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
=> (clojure.core.server/start-server {:name "debug connection" :port 5555 :accept 'clojure.core.server/repl}) | |
#object[java.net.ServerSocket 0x631883f0 "ServerSocket[addr=localhost/127.0.0.1,localport=5555]"] |
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
(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
+user=> (def c (ProcessBuilder. (into-array ["cat"]))) | |
#'user/c | |
+user=> (def p (.start c)) | |
#'user/p | |
+user=> (def o (.getOutputStream p)) | |
#'user/o | |
+user=> (.write o (.getBytes "hello\n\n")) | |
nil | |
+user=> (.flush o) | |
nil |
NewerOlder