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
(use '[datomic.api :only (q db) :as d]) | |
(def uri "datomic:mem://user-groups3") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
(d/transact | |
conn | |
[{:db.install/_attribute :db.part/db | |
:db/id #db/id[:db.part/db] | |
:db/ident :user/name |
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
<html> | |
<head> | |
</head> | |
<body> | |
</body> | |
</html> |
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 user | |
(:require [clojure.java.io :as io] | |
[datomic.api :as d])) | |
(defn order-schema [] | |
(read-string (slurp (io/resource "schema.edn")))) | |
(defn start-datomic! [uri schema] | |
(d/create-database uri) | |
(let [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
(defn words-proc [words button interval interval-control scrub] | |
(go (loop [idx 0] | |
(show-word! words idx) | |
(let [[v c] (alts! [button interval scrub]) | |
(condp = c | |
button (do (>! interval-control v) | |
(recur idx)) | |
interval (recur (inc idx)) | |
scrub (do (>! interval-control :stop) | |
(recur 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
(def history (Html5History.)) | |
(.setUseFragment history false) | |
(.setPathPrefix history "") | |
(.setEnabled history true) | |
(let [navigation (listen history EventType/NAVIGATE)] | |
(go | |
(while true | |
(let [token (.-token (<! navigation))] | |
(secretary/dispatch! token))))) |
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
;; Complete schema history for a live Datomic database. | |
(require | |
'[clojure.pprint :as pp] | |
'[clojure.set :as set] | |
'[datomic.api :as d]) | |
;; fill this in with your own database connection | |
(def uri "datomic:dev://localhost:4334/my-db") | |
(def conn (d/connect uri)) | |
(def db (d/db conn)) |
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
;; Datomic example code | |
;; make in memory database | |
(use '[datomic.api :only (q db) :as d]) | |
(def uri "datomic:mem://matches") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
;; add the match attribute | |
(d/transact |
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 blog.errors.core | |
(:require-macros | |
[cljs.core.async.macros :refer [go]] | |
[blog.utils.macros :refer [<?]]) | |
(:require | |
[cljs.core.async :refer [>! <! chan close!]])) | |
;; convert Node.js async function into a something | |
;; that returns a value or error on a channel | |
(defn run-task [f & args] |
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
;; Some example error messages resulting from common mistakes | |
;; using Datomic 0.8.4138 | |
(ns errors | |
(:use [datomic.api :as d :only (db q)])) | |
(def uri "datomic:mem://database") | |
(d/create-database 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
/* | |
* http://www.myersdaily.org/joseph/javascript/md5-text.html | |
*/ | |
(function (global) { | |
var md5cycle = function (x, k) { | |
var a = x[0], | |
b = x[1], | |
c = x[2], | |
d = x[3]; |
OlderNewer