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 om.core | |
(:require [reagent.core :as r])) | |
(defn component? [x]) | |
(defprotocol IInitState (init-state [_])) | |
(defprotocol IRender (render [this])) | |
(defprotocol IRenderState (render-state [this state])) | |
(defprotocol IDisplayName (display-name [this])) | |
(defprotocol IWillReceiveProps (will-receive-props [this next-props])) |
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
(->> (for [{:keys [table_name]} (db-tables db {:schemaPattern "AFM"})] | |
[table_name (db-query db (str "select * from " table_name))]) | |
(into {}) | |
(spit "db.edn")) |
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 serverless.pmr-spec | |
(:require [clojure.spec :as s])) | |
(s/def ::spec | |
(s/or ::table (s/cat :s #{`s/keys 's/keys} :pairs (s/* any?)) | |
::many-rel (s/cat :s #{`s/every} :pred any? :opts (s/* any?)) | |
::and (s/cat :s #{`s/and} :pred-forms (s/* any?)) | |
::other any?)) |
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 olivergeorge.spec-walking-pred-collection | |
(:require [clojure.spec :as s] | |
[clojure.core.match :refer [match]])) | |
(defn max-length [max]) | |
(s/def ::inline-fn (s/cat ::op #{`fn} :rest (s/+ any?))) | |
(s/def ::fn-builder (s/cat :fn ifn? :args (s/* any?))) | |
(defn inline-fn? [x] (s/valid? ::inline-fn x)) | |
(defn fn-builder? [x] (s/valid? ::fn-builder x)) |
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 example.virtualized | |
(:require cljsjs.react-virtualized | |
cljsjs.react | |
[cljs.spec :as s] | |
[re-frame.core :as re-frame])) | |
(def ArrowKeyStepper* (js/React.createFactory js/ReactVirtualized.ArrowKeyStepper)) | |
(def AutoSizer* (js/React.createFactory js/ReactVirtualized.AutoSizer)) | |
(def Collection* (js/React.createFactory js/ReactVirtualized.Collection)) |
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 condense.spec->sql | |
(:require [clojure.spec :as s])) | |
(defn varchar [max] | |
#(and (string? %) (<= (count %) max))) | |
(defn lift-type | |
"Simple transformation of data. #{[t v1] [t v2]...} => [t #{v1 v2}]" | |
[typed-vals] | |
(let [types (map first typed-vals) |
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 condense.obj-lookup | |
"Extends js/Object to implement ILookup so we can destructure." | |
(:require [goog.object :as gobject])) | |
(extend-protocol ILookup | |
object | |
(-lookup | |
([o k] (gobject/get o k)) | |
([o k not-found] (gobject/get o k not-found)))) |
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 devcards-vs-clojure-spec.code-as-data | |
(:require [clojure.spec :as s])) | |
; detect the "pull-spec type" associated with a spec | |
(defmulti pull-type* first) | |
(defn pull-type [spec] | |
(when (seq? spec) | |
(pull-type* 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
(defn mean [xs] | |
(/ (apply + xs) | |
(count xs))) | |
(defn variance [xs] | |
(let [m (mean xs) | |
square-error (fn [x] | |
(Math/pow (- x m) 2))] | |
(mean (map square-error xs)))) |
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 labs.demo | |
(:require [clojure.spec :as s] | |
[clojure.test.check.generators :as generators] | |
[clojure.test.check.random :as random] | |
[clojure.test.check.rose-tree :as rose-tree] | |
[sablono.core :as sab :include-macros true])) | |
(defonce demo-db (atom {:seed 1 :size 5 :overrides {}})) | |
(defn add-override [k v] |