Skip to content

Instantly share code, notes, and snippets.

View pleasetrythisathome's full-sized avatar

Scarlet Dame pleasetrythisathome

View GitHub Profile
;; setup db to test with
;; note that this setup uses a local dev transactor
;; you can use a different transactor, but you cannot
;; use a mem db because it does not support the log API
(require '[datomic.api :as d])
(def uri "datomic:dev://localhost:4334/reified-txes")
(d/delete-database uri)
(d/create-database uri)
(def conn (d/connect uri))
@w01fe
w01fe / resource.clj
Last active August 29, 2015 14:23
resource.clj
(ns plumbing.resource
(:refer-clojure :exclude [with-open])
(:require
[schema.core :as s]
[plumbing.core :as plumbing]
[plumbing.fnk.pfnk :as pfnk]
[plumbing.fnk.schema :as schema]
[plumbing.graph :as graph]
[plumbing.logging :as log]
[plumbing.map :as map]
@eslick
eslick / datomic-schema.clj
Last active May 6, 2016 02:56
One solution to integrating Schema and Datomic
(in-ns test
(:require
[schema.macros :as macros]
[schema.utils :as sutils]))
;; Wrapper type needed because Entity values do not implement
;; IPersistentMap interface
(defrecord EntitySchema
[schema]
Schema

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

(ns node-test.core
(:require [cljs.nodejs :as nodejs]))
(nodejs/enable-util-print!)
(def cp (.-spawn (nodejs/require "child_process")))
(defn run-cmd [cmd args call-back]
(let [child (cp cmd args)]
(.on (.-stdout child) "data" call-back)
(.on (.-stdout child) "end" #(println (str cmd " process ended")))))
@ptaoussanis
ptaoussanis / transducers.clj
Last active December 17, 2021 13:54
Quick recap/commentary: Clojure transducers
(comment ; Fun with transducers, v2
;; Still haven't found a brief + approachable overview of Clojure 1.7's new
;; transducers in the particular way I would have preferred myself - so here goes:
;;;; Definitions
;; Looking at the `reduce` docstring, we can define a 'reducing-fn' as:
(fn reducing-fn ([]) ([accumulation next-input])) -> new-accumulation
;; (The `[]` arity is actually optional; it's only used when calling
;; `reduce` w/o an init-accumulator).
@swannodette
swannodette / om_data.cljs
Last active January 9, 2021 16:09
Om + DataScript
(ns om-data.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[datascript :as d]))
(enable-console-print!)
(def schema {})
(def conn (d/create-conn schema))
@mbostock
mbostock / .block
Last active February 25, 2024 17:46
Closest Point on Path
license: gpl-3.0
@jonathandixon
jonathandixon / .gitignore
Last active January 5, 2021 22:01
Cordova CLI project .gitignore and helper script. Useful when you don't want to commit the platforms and plugins directories to version control. http://stackoverflow.com/q/17911204/417568
platforms/
plugins/
@stuarthalloway
stuarthalloway / Datomic News Updates
Created June 18, 2012 14:53
Datomic update examples against a social news database
;; Datomic example code
;; demonstrates various update scenarios, using a news database
;; that contains stories, users, and upvotes
;; grab an in memory database
(use '[datomic.api :only (q db) :as d])
(def uri "datomic:mem://foo")
(d/create-database uri)
(def conn (d/connect uri))