Skip to content

Instantly share code, notes, and snippets.

💨 💨

Enzzo souenzzo

💨 💨
View GitHub Profile
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)))
souenzzo / deps.edn
Last active Apr 23, 2019
import do not search for cljc files
View deps.edn
;; should work, once it was required first
;; clj -Srepro -Sdeps '{:deps {import-bug {:git/url "" :sha "fd49010c7fee88bc3fb705d5fd494718bbd16f18"}}}' -m ok
;; should fail, once import will not search for cljc files
;; clj -Srepro -Sdeps '{:deps {import-bug {:git/url "" :sha "fd49010c7fee88bc3fb705d5fd494718bbd16f18"}}}' -m fail
{:paths ["."]
:deps {org.clojure/clojure {:mvn/version "1.10.1-beta2"}}}
View resolver.clj
(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 = ?"
View gist:e67571042d10f94a2b70840566ad9e13
(ns nondeps.core)
(defn -main
(let [f @#'clojure.core/load
paths (atom [])]
(with-redefs [clojure.core/load (fn [& path]
(swap! paths concat path)
(apply f path))]
View windows95.css
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;