Skip to content

Instantly share code, notes, and snippets.

thosmos / specfn.clj
Created Sep 5, 2018 — forked from borkdude/specfn.clj
Use a spec for defining function arguments and get validation automatically
View specfn.clj
(ns specfn.core
(:require [clojure.spec :as s]
[clojure.spec.test :as t]))
(defn- spec-symbols [s]
(->> s
(drop 1)
(partition-all 2)
(map first)
(map name)
thosmos / firebase-firestore-externs.js
Created May 21, 2018
Externs for Google Firebase's Firestore
View firebase-firestore-externs.js
firebase.firestore = function(app) {}; = function(app) {};
firebase.firestore.Firestore = function() {};
firebase.firestore.Firestore = {};;
firebase.firestore.Firestore.setLogLevel = function(logLevel) {};
firebase.firestore.Firestore.prototype.batch = function () {};
firebase.firestore.Firestore.prototype.collection = function (collectionPath) {};
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?]
(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 / 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]