This file contains hidden or 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 gym.core) | |
(def db | |
{:equipment {:dumbells {:equipment :dumbells | |
:weights (vec (range 10 40 2))} | |
:barbell {:equipment :barbell | |
:weights (vec (range 20 300 2.5))} | |
:barbell2 {:equipment :barbell | |
:weights (vec (range 20 300 5))}} | |
This file contains hidden or 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
(def db (atom {:counter 0})) | |
(defmulti query (fn [db query-v] query-v)) | |
(defmethod query :default | |
[db query-v] | |
(cond | |
(keyword? query-v) (get db query-v) | |
(vector? query-v) (get-in db query-v) | |
(set? query-v) (select-keys db (into [] query-v)) |
This file contains hidden or 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 ["resources" "src"] | |
:deps {org.clojure/clojure {:mvn/version "1.10.0-rc2"}} | |
:aliases | |
{:nrepl {:extra-deps {nrepl/nrepl {:mvn/version "0.5.0"} | |
cider/cider-nrepl {:mvn/version "0.19.0-SNAPSHOT"} | |
refactor-nrepl {:mvn/version "2.4.0"}} | |
:main-opts ["-m" "nrepl.cmdline" | |
"--middleware" "[cider.nrepl/cider-middleware,refactor-nrepl.middleware/wrap-refactor]"]}}} |
This file contains hidden or 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 compound2.core) | |
(defn no-op | |
([acc] acc) | |
([acc x] acc)) | |
(defn connect | |
"Connects a tree of transducers together" | |
[[xf & xfs]] | |
(let [xfs (map #(if (vector? %) (connect %) %) xfs)] |
This file contains hidden or 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 onions.core | |
"Clojure tachyons for react native. | |
Provides a shorthand to a constrained set of atomic css properties i.e. | |
(style [:flx-row :aifs :jcsb :bg-ui0 :br1]) ; => | |
{:flexDirection "row", | |
:alignItems "flex-start", | |
:justifyContent "space-between", |
This file contains hidden or 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 gym.core) | |
(def db | |
{:equipment [{:equipment :dumbells | |
:weights (vec (range 10 40 2))} | |
{:equipment :barbell | |
:weights (vec (range 20 300 2.5))}] | |
:exercises [{:exercise :dumbell-bench | |
:equipment :dumbells} | |
{:exercise :squat |
This file contains hidden or 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 compound.scratch | |
(:require [net.cgrand.xforms :as x])) | |
(defmulti plus identity) | |
(defmulti minus identity) | |
(defmulti xform identity) | |
(defmulti zero identity) | |
(defmethod plus :count-odd-a [_] (fn | |
([a] a) |
This file contains hidden or 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 app.graphql-interceptor | |
(:require [re-frame.core :as reframe :refer [->interceptor]] | |
[cljs.spec.alpha :as s] | |
[app.reg-event :refer [reg-event-fx]] | |
[app.util :as util] | |
[clojure.set :as set])) | |
(set! *warn-on-infer* true) | |
(def graphql->http |
This file contains hidden or 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 stupidsense.core | |
(:require [clojure.spec.alpha :as s] | |
[clojure.string :as str] | |
[clojure.core.specs.alpha])) | |
(def blacklist-ns #{"clojure.core"}) | |
(defn fn-specs [registry] | |
(into {} (for [[sym spec] registry | |
:let [form (s/form spec)] |
This file contains hidden or 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
;; How do I get the args of a fn spec? | |
;; (I'd like to do some kind of dumb intellisense using specs in the registry) | |
;; For example, with a function a | |
(defn a [m] | |
(get m :foo)) | |
(s/fdef a | |
:args (s/cat :m map?) | |
:ret int?) |