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
(time (let [baos (ByteArrayOutputStream.) | |
data [[:foo :bar]]] | |
(-> (apply uber/multidigraph data) | |
(uber/viz-graph {:save {:format :svg | |
:filename baos}})) | |
(-> (xml/parse (io/input-stream (.toByteArray baos))) | |
(assoc-in [:attrs :data] (pr-str data)) | |
(xml/emit-str) | |
(.getBytes) | |
(io/input-stream) |
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
(let [xparir-transform (fn [{:keys [initial-value transform-fn]}] | |
(fn [rf] | |
(let [old (volatile! initial-value)] | |
(fn | |
([] (rf)) | |
([result] (rf result)) | |
([result input] | |
(let [new (transform-fn input @old)] | |
(vreset! old input) | |
(rf result new)))))))] |
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 len [x] | |
(.length x)) | |
(defn len2 [^String x] | |
(.length x)) | |
(defprotocol ILengthable | |
(len3 [this])) | |
(extend-protocol ILengthable | |
String | |
(len3 [this] (.length this))) |
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
;; should work, once it was required first | |
;; clj -Srepro -Sdeps '{:deps {import-bug {:git/url "https://gist.github.com/souenzzo/e23944fac595077f372aa662cde5ff91" :sha "fd49010c7fee88bc3fb705d5fd494718bbd16f18"}}}' -m ok | |
;; should fail, once import will not search for cljc files | |
;; clj -Srepro -Sdeps '{:deps {import-bug {:git/url "https://gist.github.com/souenzzo/e23944fac595077f372aa662cde5ff91" :sha "fd49010c7fee88bc3fb705d5fd494718bbd16f18"}}}' -m fail | |
{:paths ["."] | |
:deps {org.clojure/clojure {:mvn/version "1.10.1-beta2"}}} |
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 username-by-id | |
{::pc/kind pc/resolver | |
::pc/input #{:app.user/id} | |
::pc/output [:app.user/username]} | |
[{::keys [db]} {:app.user/keys [id]}] | |
{:app.user/username (-> (j/query db ["SELECT username FROM app_user WHERE id = ?" | |
id]) | |
first | |
:username)}) |
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 nondeps.core) | |
(defn -main | |
[target] | |
(let [f @#'clojure.core/load | |
paths (atom [])] | |
(with-redefs [clojure.core/load (fn [& path] | |
(swap! paths concat path) | |
(apply f path))] |
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
button { | |
background-color: #c3c7cb; | |
border: none; | |
padding: 7px 20px 5px; | |
box-shadow: inset 1px 1px 0 1px #ffffff, inset 0 0 0 1px #868a8e, 1px 1px 0 0 #000; | |
} |
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
;; run with | |
;; clj -Sdeps '{:deps {gdocs {:git/url "https://gist.github.com/souenzzo/df540002607b15378f8014237e499fdd" :sha "fee00617c75fc24c74931aa4200f74666c5b66b6"}}}' -m gdocs | |
{:paths ["."] | |
:deps {org.clojure/clojure {:mvn/version "1.10.0"} | |
com.google.api-client/google-api-client {:mvn/version "1.28.0"} | |
com.google.oauth-client/google-oauth-client-jetty {:mvn/version "1.28.0"} | |
com.google.apis/google-api-services-sheets {:mvn/version "v4-rev566-1.25.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
import java.util.Objects; | |
public class Main { | |
public static void main(String[] args) { | |
var foo = new Object() { | |
String x = "aa"; | |
}; | |
Thread t; | |
t = new Thread(() -> { | |
if (Objects.nonNull(foo.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
{:paths ["."] | |
:deps {org.clojure/clojure {:mvn/version "1.10.0"} | |
com.walmartlabs/lacinia {:mvn/version "0.32.0"} | |
io.pedestal/pedestal.service {:mvn/version "0.5.5"} | |
io.pedestal/pedestal.jetty {:mvn/version "0.5.5"} | |
com.walmartlabs/lacinia-pedestal {:mvn/version "0.11.0"} | |
org.clojure/test.check {:mvn/version "0.10.0-alpha3"} | |
com.rpl/specter {:mvn/version "1.1.2"}}} |