Skip to content

Instantly share code, notes, and snippets.

View olivergeorge's full-sized avatar

Oliver George olivergeorge

  • Tasmania, Australia
View GitHub Profile
import MaskedInput from 'react-text-mask';
window.MaskedInput = MaskedInput;
@olivergeorge
olivergeorge / check_async.cljs
Last active September 6, 2019 06:46
Quick experiment to modify clojure.test.check to work with async tests via cljs.core.async promise-chan
; Copyright (c) Rich Hickey, Reid Draper, and contributors.
; All rights reserved.
; The use and distribution terms for this software are covered by the
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
; which can be found in the file epl-v10.html at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.

This is a bit of a thought exercise. I doubt it’s perfect and I’m hoping for opinions and corrections with the goal of a well reasoned practical approach.

Motivation...

One way to look at type declarations in a static language is as a test which picks up potential incompatible code paths. E.g. data passed is incompatible with code.

In static languages the effort to write the test is reduced by virtue of being declared inline with the code and inference allows a few annotations to permeate - having said that we can achieve a similar results in Clojure.

Quick scan of tools at hand...

(ns statecharts
(:require [clojure.set :as set]))
(def states
(-> (make-hierarchy)
(derive ::update ::displays)
(derive ::wait ::displays)
(derive ::time ::displays)
(derive ::date ::displays)
(derive ::alarm1 ::displays)
@olivergeorge
olivergeorge / mssql-modified.md
Last active July 30, 2019 00:13
What's been modified on our Microsoft SQL Server database?

Used to check that stored procedures had been compiled after adding some indexes.

select top 10000
       name as 'Name',
       type_desc as 'Type',
       modify_date as 'Modified',
       create_date as 'Created'
(ns xml-to-datascript-roundtrip
(:require [clojure.xml :as xml]
[clojure.java.io :as io]
[datascript.core :as d]))
(def element1 (xml/parse (io/file (io/resource "example.xml"))))
(let [*counter (atom 0)]
(defn genid []
(swap! *counter dec)))
@olivergeorge
olivergeorge / Makefile
Last active August 13, 2021 02:06
Devops tools for simple Datomic Ions app
provision:
clojure -A:dev -m devops provision
teardown:
clojure -A:dev -m devops teardown
cloud-on:
clojure -A:dev -m devops cloud-on

Experiment to setup a single step deploy process for Datomic Ions including setting up the AWS API Gateway.

Next experiment will be generating a CloudFormation template for the app.

@olivergeorge
olivergeorge / es6-class-react.cljs
Created May 23, 2018 03:01 — forked from pesterhazy/es6-class-react.cljs
React component in pure cljs using ES6 class inheritance
;; implementing a React component in pure cljs, no reagent necessary
;; using goog.object.extend to create a ES6 class that inherits from
;; React.Component
;; credit to @thheller
(defn MyReact [props context updater]
(this-as this
(js/React.Component.call this props context updater)))