Skip to content

Instantly share code, notes, and snippets.

View alexanderkiel's full-sized avatar

Alexander Kiel alexanderkiel

View GitHub Profile
@alexanderkiel
alexanderkiel / entity.clj
Created March 15, 2013 11:37
Minimal example which shows that traversing ref attributes from an entity result in just the keyword for entities with :db/ident and in the full entity for entities without a :db/ident.
(require '[datomic.api :as d])
(d/create-database "datomic:mem://test")
(def conn (d/connect "datomic:mem://test"))
;; Add the schema
(d/transact conn [{:db/id (d/tempid :db.part/db )
:db/ident :community/type
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one
@alexanderkiel
alexanderkiel / Dockerfile
Created March 14, 2014 16:40
Deis: Configure a Chef Server
FROM ubuntu:13.10
RUN locale-gen --no-purge en_US.UTF-8
ENV LC_ALL en_US.UTF-8
RUN apt-get update
RUN apt-get -yq install ruby2.0 ruby2.0-dev git build-essential
RUN gem install bundler berkshelf
ADD client.pem /
@alexanderkiel
alexanderkiel / typeahead-search-field.clj
Last active August 29, 2015 14:00
An example of a non-trivial but reusable Om component. You need Twitter Bootstrap 3 and Font Awesome 4 CSS.
(ns typeahead-search-field
(:require-macros [cljs.core.async.macros :refer [go-loop]])
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[cljs.core.async :as async :refer [put! chan <! >! alts!]]))
(defn typeahead-search-field
"Renders a standalone typeahead search field.
The search field collects the chars typed and executes a search after
Jun 23 18:02:45 deis-1 docker[12507]: Accepted publickey for git from 172.17.42.1 port 44368 ssh2
Jun 23 18:02:45 deis-1 docker[12507]: Received disconnect from 172.17.42.1: 11: disconnected by user
Jun 23 18:03:10 deis-1 docker[12507]: Accepted publickey for git from 172.17.42.1 port 44442 ssh2
Jun 23 18:03:10 deis-1 docker[12507]: 2014/06/23 18:03:10 POST /v1.11/containers/create
Jun 23 18:03:10 deis-1 docker[12507]: [2694e9f0] +job create()
Jun 23 18:03:10 deis-1 docker[12507]: [2694e9f0] -job create() = OK (0)
Jun 23 18:03:10 deis-1 docker[12507]: 2014/06/23 18:03:10 POST /v1.11/containers/763ebf685ece4b0fdf27ed1f9cc7836c34723beaa9f7bb9708d8aa0fffc80508/attach?stdin=1&stream=1
Jun 23 18:03:10 deis-1 docker[12507]: [2694e9f0] +job inspect(763ebf685ece4b0fdf27ed1f9cc7836c34723beaa9f7bb9708d8aa0fffc80508, container)
Jun 23 18:03:10 deis-1 docker[12507]: [2694e9f0] -job inspect(763ebf685ece4b0fdf27ed1f9cc7836c34723beaa9f7bb9708d8aa0fffc80508, container) = OK (0)
Jun 23 18:03:10 deis-1 docker[12507]: [2694e9f0
@alexanderkiel
alexanderkiel / spec-test.clj
Created May 31, 2016 15:55
Integration of check-var in clojure.test/is
(defmethod assert-expr 'conform-var? [msg form]
;; Test if the var v conforms to it's spec.
(let [args (rest form)]
`(let [result# (clojure.spec.test/check-var ~@args)]
(if (true? (:result result#))
(do-report {:type :pass :message ~msg
:expected '~form :actual result#})
(do-report {:type :fail :message ~msg
:expected '~form :actual result#}))
result#)))
@alexanderkiel
alexanderkiel / ring-spec.clj
Last active April 8, 2018 20:06
An attempt to write a ring spec in clojure.spec.
(ns ring.spec
(:require [clojure.java.io :as io]
[clojure.spec :as s]
[clojure.spec.gen :as gen]
[clojure.string :as str])
(:import [java.io File InputStream]))
;; ---- Internal Primitives ---------------------------------------------------
(def ^:private token-pattern #"[\!#$%&'*+-.^_`|0-9A-Za-z]+")
;; I have the following specs
(s/def ::product-id int?)
(s/def ::amount int?)
(s/def ::price bigdec?)
(s/def ::line-item
(s/keys :req [::product-id ::amount ::price]))
(s/def ::line-items
(s/coll-of ::line-item))

Keybase proof

I hereby claim:

  • I am alexanderkiel on github.
  • I am akiel (https://keybase.io/akiel) on keybase.
  • I have a public key ASCIVnTDEAOcjWvpyBBiQt1ijn6hiurmS9uajUMpuHswywo

To claim this, I am signing this object:

@alexanderkiel
alexanderkiel / phrase-map-01.cljs
Created January 17, 2018 15:01
Example of Phrase for Map Validation
#!/usr/bin/env planck -D phrase:0.3-alpha2
(require '[clojure.spec.alpha :as s])
(require '[phrase.alpha :refer [defphraser phrase]])
(s/def ::required-string (s/and string? not-empty))
(s/def ::name ::required-string)
(s/def ::phone (s/and string? #(re-matches #"(\+47)?\d+" %)))
(s/def ::email (s/and string? #(re-matches #".+@.+" %)))
(s/def ::first-name ::name)
{
"name": "gba-broker-ui-ng",
"version": "0.1.0",
"description": "",
"private": true,
"dependencies": {
"@material/button": "^0.40.0",
"@material/card": "^0.40.0",
"@material/checkbox": "^0.40.0",
"@material/dialog": "^0.40.0",