Skip to content

Instantly share code, notes, and snippets.

💨 💨

Enzzo souenzzo

💨 💨
View GitHub Profile
View foo.clj
(ns digital-wallet.main-test-old
(:require [clojure.test :refer [deftest]]
[midje.sweet :refer [fact =>]])
(:import (clojure.lang ILookup)
(java.lang AutoCloseable)
(java.util Properties)
(org.apache.kafka.common.serialization Serdes Serdes$StringSerde Serdes$LongSerde)
(org.apache.kafka.streams TopologyTestDriver StreamsConfig Topology KeyValue)
(org.apache.kafka.streams.processor.api ProcessorSupplier Processor ProcessorContext Record)
(org.apache.kafka.streams.state Stores KeyValueStore)
View eql-hodur.clj
(ns eql-hodur
(:require [edn-query-language.core :as eql]
[clojure.spec.alpha :as s]
[datascript.core :as ds]))
(defn add-prop
[prop {:keys [children]
:as node}]
(if (contains? node :children)
(assoc node
souenzzo / deps.edn
Last active Sep 8, 2020
Browser presign POST upload using AWS-SDK
View deps.edn
;; reference
{:deps {org.clojure/clojure {:mvn/version "1.10.1"}
hiccup/hiccup {:mvn/version "2.0.0-alpha2"}
io.pedestal/pedestal.jetty {:mvn/version "0.5.8"}
io.pedestal/pedestal.service {:mvn/version "0.5.8"}
commons-codec/commons-codec {:mvn/version "1.15"} {:mvn/version "0.8.474"} {:mvn/version ""}
souenzzo / cola.edn
Created Jun 20, 2020
View cola.edn
;; hello eql
;; data->shape
{:app/hello "ok"}
{:app/hello "ok"
:app/users [{:user/id 1
:user/username "2"
:user/addresses [{:address/description "a"
:address/number 1}]}]}
View pathom.clj
(let [conn (doto (ds/create-conn {:user/addresses {:db/valueType :db.type/ref
:db/cardinality :db.cardinality/many}
:user/id {:db/unique :db.unique/identity}})
(ds/transact! [{:user/id 1
:user/addresses [-1 -2]}
{:user/id 2
:user/addresses [-2 -3]}
{:user/id 3
:user/addresses [-4]}
{:db/id -1
View java_http.clj
(:require [com.wsscode.pathom.diplomat.http :as http]
[clojure.spec.alpha :as s]
[clojure.core.async :as async]
[clojure.string :as string]
[ :as json])
(:import ( HttpResponse$BodyHandlers HttpRequest HttpClient HttpResponse HttpHeaders HttpRequest$BodyPublishers)
( URI)
(java.util.function Function BiPredicate)
(java.util Optional)))
souenzzo / pathom.clj
Created Jan 10, 2020
pathom vs select-keys
View pathom.clj
(let [parser (p/parser {::p/plugins [(pc/connect-plugin {::pc/register [(pc/constantly-resolver ::f 42)]})]})
env {::p/reader [p/map-reader
query [::f]
m {::f 42}]
(doseq [[k v] {:map-select #(p/map-select m query)
:parser #(parser env query)
:select-keys #(select-keys env query)}]
(prn k)
(dotimes [i 5]
souenzzo / pr.clj
Created Nov 20, 2019
Run with "clj -A:dev -m" or "clj -A:pr"
View pr.clj
(:require [ :as aws]
[clj-http.client :as http]
[ :as io])
(:import (org.eclipse.jgit.api Git)))
(defn slack->request
{:method :post
:url ""
souenzzo / find-unused-deps.clj
Created Nov 4, 2019
View find-unused-deps.clj
(let [{:keys [namespace-usages]} (:analysis (kondo/run! {:lint ["src/main"
:config {:output {:analysis true}}}))
url->splited-path #(into []
(comp (map (memfn getFileName))
(map str)
(take-while (complement string/blank?)))
(iterate (fn [x] (when x (.getParent x)))
(Paths/get (new URI (-> (str %)
(string/replace #"^jar\:"