Skip to content

Instantly share code, notes, and snippets.

@thosmos
thosmos / broadbrim.datomic.api.cljc
Created Dec 16, 2015 — forked from domkm/broadbrim.datomic.api.cljc
Datomic EntityMap wrapper for DataScript consistency
View broadbrim.datomic.api.cljc
;;;; Entity wrapper
#?(:clj (declare ->EntityMap))
#?(:clj (deftype EntityMap [^datomic.query.EntityMap entity ^boolean ident?]
Object
(hashCode [this]
(.hashCode entity))
(equals [this o]
(and (instance? (class this) o)
(.equals entity (.entity o))))
View router.cljs
(def views
{:some-view SomeView
:another-view AnotherView})
(def factories
(map om/factory (vals views)))
(defui Router
static om/Ident
(ident [this {:keys [route]}]
@thosmos
thosmos / core.cljs
Last active Nov 11, 2015
Om Next Ident + IKey
View core.cljs
(ns om-tutorial.core
(:require [goog.dom :as gdom]
[om.next :as om :refer-macros [defui]]
[om.dom :as dom]
[cljs.pprint :as pprint]))
(enable-console-print!)
(def conn
(d/create-conn
@thosmos
thosmos / mock-connection.clj
Created Oct 21, 2015 — forked from vvvvalvalval/mock-connection.clj
Mocking datomic.Connection for fast in-memory testing
View mock-connection.clj
(ns bs.utils.mock-connection
"Utilities for using Datomic"
(:require [datomic.api :as d])
(:use clojure.repl clojure.pprint)
(:import (java.util.concurrent BlockingQueue LinkedBlockingDeque)
(datomic Connection)))
(defrecord MockConnection
[dbAtom, ^BlockingQueue txQueue]
@thosmos
thosmos / components.cljs
Last active Aug 29, 2015
Imagining atomatizing the App
View components.cljs
;; see blog post here: http://code.thosmos.com/om/clojurescript/2014/12/15/imagining-atomatizing-the-app.html
{ :ns "hmmm.core"
:require ["om.core :as om :include-macros true"
"om.dom :as dom :include-macros true"]
:app {
:root [:app-state :app-def {:elementId "content"}]
View designer.html
<link href="../core-scaffold/core-scaffold.html" rel="import">
<link href="../core-header-panel/core-header-panel.html" rel="import">
<link href="../core-menu/core-menu.html" rel="import">
<link href="../core-item/core-item.html" rel="import">
<link href="../core-icon-button/core-icon-button.html" rel="import">
<link href="../core-toolbar/core-toolbar.html" rel="import">
<link href="../core-menu/core-submenu.html" rel="import">
<link href="../paper-button/paper-button.html" rel="import">
<link href="../paper-checkbox/paper-checkbox.html" rel="import">
<link href="../core-icons/core-icons.html" rel="import">
View main.py
# main.py
print "Hello, Geometry Zen!"