Skip to content

Instantly share code, notes, and snippets.


Enzzo souenzzo

Block or report user

Report or block souenzzo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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\:"
View xf.clj
(let [atributo->item {:a {:atributo :a
:selecionado? true}
:b {:atributo :b
:selecionado? false}
:c {:atributo :c}}]
{:reduce (reduce-kv (fn [acc k {:keys [selecionado?]}]
(if (false? selecionado?)
(conj acc k)))
View exemplo.clj
(ns exemplo
(:require [io.pedestal.http :as http]))
(def routes ::invalid)
(def server-build-time
(-> {::http/type :jetty
::http/routes routes
::http/port 8080}
View tiny-om.cljs
(ns tiny-om.client
(:require ["react" :as r]
[goog.dom :as gdom]
["react-dom" :as r.dom])
(:require [clojure.core.async :as async]))
(defn el
[app type props & children]
(apply r/createElement (name type) (clj->js props) children))
View graph_bot.clj
(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))
View xform.clj
(let [xparir-transform (fn [{:keys [initial-value transform-fn]}]
(fn [rf]
(let [old (volatile! initial-value)]
([] (rf))
([result] (rf result))
([result input]
(let [new (transform-fn input @old)]
(vreset! old input)
(rf result new)))))))]
View interop.clj
(defn len [x]
(.length x))
(defn len2 [^String x]
(.length x))
(defprotocol ILengthable
(len3 [this]))
(extend-protocol ILengthable
(len3 [this] (.length this)))
You can’t perform that action at this time.