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
(require '[datahike.api :as d]) | |
(def schema [{:db/ident :name | |
:db/cardinality :db.cardinality/one | |
:db/index true | |
:db/unique :db.unique/identity | |
:db/valueType :db.type/string} | |
{:db/ident :sibling | |
:db/cardinality :db.cardinality/many | |
:db/valueType :db.type/ref} |
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
(require '[datahike.api :as d]) | |
(def uri "datahike:mem://simple_recursion") | |
(d/delete-database uri) | |
(d/create-database uri :schema-on-read true) | |
(def conn (d/connect uri)) |
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
;; based on http://worace.works/2016/06/05/rsa-cryptography-in-clojure | |
(def cipher-algorithm "RSA/ECB/PKCS1Padding") | |
(defn key-pair-generator [length] | |
(doto (java.security.KeyPairGenerator/getInstance "RSA") | |
(.initialize length))) | |
(defn generate-keypair [length] |
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
{:user | |
{:plugins [[cider/cider-nrepl "0.16.0-SNAPSHOT"] | |
[jonase/eastwood "0.2.5"] | |
[lein-kibit "0.1.6-beta2"] | |
[refactor-nrepl "2.4.0-SNAPSHOT"]] | |
:dependencies [[org.clojure/tools.nrepl "0.2.12"]]}} |
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
{ | |
"name": "WEB APP", | |
"version": "1.0.0", | |
"description": "DESCRIPTION", | |
"main": "server.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"dev": "webpack-dev-server --inline", | |
"start": "node_modules/.bin/babel-node server.js" | |
}, |
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 parse-params | |
"Parse URL parameters into a hashmap" | |
[] | |
(let [param-strs (-> (.-location js/window) (split #"\?") last (split #"\&"))] | |
(into {} (for [[k v] (map #(split % #"=") param-strs)] | |
[(keyword k) v])))) |
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 random-string [n] | |
(let [chars (map char (concat (range 48 58) (range 65 91) (range 97 123)))] | |
(apply str (take n (repeatedly #(rand-nth chars)))))) |
NewerOlder