Skip to content

Instantly share code, notes, and snippets.

View metasoarous's full-sized avatar
💻

Christopher Small metasoarous

💻
View GitHub Profile
@stathissideris
stathissideris / not-posh-at-all.clj
Last active September 9, 2020 05:51
An attempt to use Datascript for state management in a Swing app (no React)
(ns not-posh
(:require [clojure.string :as str]
[clojure.data :as data]
[datascript.core :as d]
[clojure.set :as set]
[seesaw.core :as ss]))
(defn- diff [a b]
;;TODO make diff ignore :swing/component key but include it in result
(let [[removed added] (data/diff a b)
@teropa
teropa / reactive2015_gol.md
Created September 24, 2015 15:56
ClojureScript Game of Life - Reactive 2015 Lightning Talk Proposal

In my proposed lightning talk for the Reactive Conference, I'll create Conway's Game of Life in ClojureScript, and I'll do it in five minutes. I'll use an interactive programming workflow enabled by Figwheel. Each piece will be added into the running application without reloading the page.

If you want to see a little cellular lifeform spawn out of nothing into an running web browser window, I'd appreciate it if you starred this Gist!

Cheers,

(@teropa)

@sparkofreason
sparkofreason / util.cljx
Last active January 20, 2016 17:44
Utility functions for bridging Datomic/Datascript
(ns allgress.datascript.util
(:require [clojure.walk :refer [postwalk]]))
;;; Datomic pull API will return :db/idents as references, like {:my-enum-att {:db/ident :enum-value}}.
;;; This function replaces with the Datascript equivalent {:my-enum-att :enum-value}. Only works
;;; for true "enums", whose only attribute in the entity map is :db/ident.
defn replace-enum-refs [entity-map]
(postwalk
(fn [arg]
(if (and (coll? arg) (map? (second arg)) (= 1 (count (second arg))) (contains? (second arg) :db/ident))
@a2ndrade
a2ndrade / gist:5234370
Last active March 15, 2019 22:21
Datomic Pro Setup: MySQL
# download
wget http://downloads.datomic.com/0.8.3848/datomic-pro-0.8.3848.zip
unzip datomic-pro-X.X.zip & cd datomic-pro-X.X
# install as a maven artifact
./bin/maven-install
# configure transactor.properties
cp config/samples/sql-transactor-template.properties transactor.properties
# protocol=sql
@pelle
pelle / accounts.clj
Created May 8, 2012 14:37
Using database functions in Datomic transactions and annotating transaction history
(use '[datomic.api :only [q db] :as d])
(def uri "datomic:mem://accounts")
;; create database
(d/create-database uri)
;; connect to database
(def conn (d/connect uri))
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db