bin/datomic backup-db "datomic:ddb://us-east-1/rest/of/url?aws_access_key_id=<ACCESS_KEY_ID>&aws_secret_key=<SECRET_KEY>" file:/home/ian/datomic-backup-`date +"%Y%d%m"`
This file contains 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
{:db/ident :bsu.fns/reset-to-many-by, | |
:db/doc "Resets the set of entities which are related to `eid` via `ref-attr` to the set given by `val-maps`. | |
Assumptions: | |
* `ref-attr` is a cardinality-many, ref attribute. | |
* `e` is an entity identifier for an _existing_ entity | |
(you have to know whether an entity exists before using this function, | |
and it's pointless to use it on a non-existing entity as opposed to just asserting all the new values.) | |
* `val-maps` is a seq of transaction maps, all of which have the `v-id-attr` key provided. | |
* `retract-target-entity?`: whether to call :db.fn/retractEntity on the old entities which get removed from the relationship. | |
* the old values of the relationship all have the `id-attr` attribute." |
Lets say you want to make form input that shows the user an error message if they leave it blank. If you typically write controlled inputs, you might do something like this simplified example:
class ControlledInput extends Component {
state = { fields: { username: "" }, errors: {} };
This file contains 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
(defvar-local unrepl-repl-input-start-mark nil) | |
(defvar-local unrepl-hello-payload nil) | |
(edn-add-reader :unrepl/param (lambda (x) `(:unrepl/param . ,x))) | |
(edn-add-reader :unrepl/ns (lambda (x) `(:unrepl/ns . ,x))) | |
(edn-add-reader :unrepl/ratio (lambda (x) `(:unrepl/ratio . ,x))) | |
(edn-add-reader :unrepl/meta (lambda (x) `(:unrepl/meta . ,x))) | |
(edn-add-reader :unrepl/pattern (lambda (x) `(:unrepl/pattern . ,x))) | |
(edn-add-reader :unrepl/object (lambda (x) `(:unrepl/object . ,x))) | |
(edn-add-reader :unrepl.java/class (lambda (x) `(:unrepl.java/class . ,x))) |
This file contains 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.components.react-bootstrap | |
(:require [cljsjs.react-bootstrap] | |
[reagent.core :as r])) | |
(def Alert (r/adapt-react-class (.-Alert js/ReactBootstrap))) | |
(def Button (r/adapt-react-class (.-Button js/ReactBootstrap))) | |
; ... | |
(def FormControl (r/adapt-react-class (.-FormControl js/ReactBootstrap))) ; WARNING: use FormControlFixed for text input controls instead | |
(defn FormControlFixed |
This file contains 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 kw-cache #js{}) | |
(defn cached-kw [fqn] | |
(if-some [kw (unchecked-get kw-cache fqn)] | |
kw | |
(let [kw (keyword fqn)] | |
(unchecked-set kw-cache fqn kw) | |
kw))) | |
(defn js->clj-fast |
This file contains 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 class-names [& args] | |
(clojure.string/join " " | |
(mapv name | |
(reduce (fn [arr arg] | |
(cond | |
(or (string? arg) | |
(symbol? arg) | |
(keyword? arg)) (conj arr arg) | |
(vector? arg) (vec (concat arr arg)) | |
(map? arg) (vec (concat arr |
This file contains 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 com.nextjournal.build-tools.figwheel.dependency | |
(:require [clojure.tools.namespace.track :as ctn.track] | |
[clojure.tools.namespace.dir :as ctn.dir] | |
[clojure.tools.namespace.file :as ctn.file] | |
[clojure.tools.namespace.dependency :as ctn.dep] | |
[clojure.tools.namespace.parse :as ctn.parse] | |
[clojure.tools.namespace.find :as ctn.find] | |
[clojure.java.io :as io] | |
[clojure.tools.reader :as reader]) | |
(:import java.io.PushbackReader)) |
This file contains 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
clj -Sdeps '{:deps {friendly {:git/url "https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18" :sha "c6b0b7cb0a30e2edbf7050c0119ef038cf0f0ac2"}}}' -m friendly | |
user=> (let [:x 5] x) | |
Call to clojure.core/let did not conform to spec: | |
-- Spec failed -------------------- | |
([:x 5] x) | |
^^ | |
should satisfy |
This file contains 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 my-component [props context updater] | |
(cljs.core/this-as this | |
(js/React.Component.call this props context updater) | |
;; anything else you want to set-up. use goog.object/set on this | |
this)) | |
(gobj/extend | |
(.. my-component -prototype) | |
js/React.Component.prototype) |
OlderNewer