Skip to content

Instantly share code, notes, and snippets.

View akmiller78's full-sized avatar

Adam Miller akmiller78

View GitHub Profile
@akmiller78
akmiller78 / closure_inheritance_cljs.cljs
Created October 19, 2016 18:59
How to inherit closure components in clojurescript
(defn CustomInputHandler []
(this-as this (.call InputHandler this)))
(goog/inherits CustomInputHandler InputHandler)
(set!
(.. CustomInputHandler -prototype -selectRow)
(fn [row opt-multi]
(this-as this
(if (.-activeElement_ this)
@akmiller78
akmiller78 / add-person.cljs
Created January 6, 2016 15:44
Om.next Form With Local State
(defui AddPerson
Object
(render [this]
(let [{:keys [add-fn]} (om/get-computed this)
clear-fn #(om/update-state! this assoc :first-name "" :last-name "")]
(dom/div nil
(dom/input #js {:type "text"
:placeholder "Firstname"
:value (om/get-state this :first-name)
:onChange #(om/update-state! this assoc :first-name (.. % -target -value))})
@akmiller78
akmiller78 / jdbc-types-jsonb
Created November 14, 2014 23:45
Extended JDBC type support for JSONB in Postgres
(ns db.jdbc-types-jsonb
(:require [jdbc.proto]
[clojure.data.json :as json])
(:import [org.postgresql.util PGobject]))
;; use the proto/ISQLType to extend a new Postgres type
;; that will be generated from a clojure map type
(extend-protocol jdbc.proto/ISQLType
clojure.lang.IPersistentMap