Skip to content

Instantly share code, notes, and snippets.

Avatar

Oliver George olivergeorge

  • Tasmania, Australia
View GitHub Profile
View index.js
import MaskedInput from 'react-text-mask';
window.MaskedInput = MaskedInput;
@olivergeorge
olivergeorge / check_async.cljs
Last active Sep 6, 2019
Quick experiment to modify clojure.test.check to work with async tests via cljs.core.async promise-chan
View check_async.cljs
; 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.
View clojure-spec-vs-type-checking.md

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...

View statecharts.clj
(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 Jul 30, 2019
What's been modified on our Microsoft SQL Server database?
View mssql-modified.md

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'
View anomaly.md
View xml_to_datascript_roundtrip.clj
(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 Aug 13, 2021
Devops tools for simple Datomic Ions app
View Makefile
provision:
clojure -A:dev -m devops provision
teardown:
clojure -A:dev -m devops teardown
cloud-on:
clojure -A:dev -m devops cloud-on
View README.md

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 — forked from pesterhazy/es6-class-react.cljs
React component in pure cljs using ES6 class inheritance
View es6-class-react.cljs
;; 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)))