Skip to content

Instantly share code, notes, and snippets.

Avatar

Dave Dixon sparkofreason

View GitHub Profile
@sparkofreason
sparkofreason / gist:efaf545b1a697af9a5c2cf3dee12680c
Created Sep 10, 2018
Exception thrown importing Clojure gen-class impl of Kafka SourceConnector
View gist:efaf545b1a697af9a5c2cf3dee12680c
#error{:cause "Implementing class",
:via [{:type clojure.lang.Compiler$CompilerException,
:message "java.lang.IncompatibleClassChangeError: Implementing class, compiling:(C:/Users/dave/Projects/Compute/metrics-kafka-connector/test/compute/metrics_kafka_connector_test.clj:1:1)",
:at [clojure.lang.Compiler load "Compiler.java" 7526]}
{:type java.lang.IncompatibleClassChangeError,
:message "Implementing class",
:at [java.lang.ClassLoader defineClass1 "ClassLoader.java" -2]}],
:trace [[java.lang.ClassLoader defineClass1 "ClassLoader.java" -2]
[java.lang.ClassLoader defineClass "ClassLoader.java" 763]
[java.security.SecureClassLoader defineClass "SecureClassLoader.java" 142]
View contour.json
{
"legends": [
{
"fill": "color",
"type": "gradient"
}
],
"config": {
"range": {
"heatmap": {
View maali-truth-maintenance.clj
(ns provisdom.examples.truth-maintenance
(:require [clojure.spec.alpha :as s]
[provisdom.maali.rules :refer [defrules defqueries defsession def-derive] :as rules]
[clara.rules.accumulators :as acc]
[clojure.pprint :refer [pprint]]))
;;; Attribute specs
(s/def ::location string?)
(s/def ::temperature number?)
(s/def ::high ::temperature)
@sparkofreason
sparkofreason / lens-cursor-inconsistency
Last active Aug 29, 2015
Inconsistencies in freactive lens-cursor and cursor behavior
View lens-cursor-inconsistency
(ns freactive-sandbox.rx-test
(:require-macros [freactive.macros :refer [rx debug-rx]])
(:require [freactive.core :refer [atom cursor lens-cursor]]
[freactive.dom :as dom]))
(enable-console-print!)
(def state (atom {:a 1 :b {:c 2 :d 3}}))
(def lc
(lens-cursor state :b))
@sparkofreason
sparkofreason / gss-polymer.html
Created Jun 9, 2015
Exception when using GSS with Polymer elements
View gss-polymer.html
<!DOCTYPE html>
<html>
<head>
<link rel="import" href="/paper-slider/paper-slider.html">
</head>
<body>
<div>
<style type="text/gss">
#d1 {
View paper-button.html
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<script src="/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="/paper-button/paper-button.html">
</head>
<body>
<div>
@sparkofreason
sparkofreason / rx-test.cljs
Last active Aug 29, 2015
rx-expression with child cursor does not update correctly
View rx-test.cljs
(ns freactive-sandbox.rx-test
(:require-macros [freactive.macros :refer [rx debug-rx]])
(:require [freactive.core :refer [atom cursor]]
[freactive.dom :as dom]))
#_(enable-console-print!)
(def state (atom {:a 1 :b {:c 2 :d 3}}))
(def b (cursor state :b))
(def d (cursor state [:b :d]))
@sparkofreason
sparkofreason / freactive-sandbox.cljs
Created Apr 21, 2015
add-watch on freactive rx expression not working?
View freactive-sandbox.cljs
(ns freactive-sandbox.core-test
(:require-macros [freactive.macros :refer [rx]])
(:require [freactive.core :refer [atom cursor]]))
(enable-console-print!)
(def x (atom {:a 1 :b {:c 2 :d 3}}))
(def b (cursor x
(fn [x] (:b x))
@sparkofreason
sparkofreason / util.cljx
Last active Jan 20, 2016
Utility functions for bridging Datomic/Datascript
View util.cljx
(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))