Skip to content

Instantly share code, notes, and snippets.

View ordnungswidrig's full-sized avatar

Philipp Meier ordnungswidrig

View GitHub Profile
@ordnungswidrig
ordnungswidrig / color-overlay-calc-klipse.cljs
Created February 2, 2017 09:19
Mutliple color overlay functions rendered with reagent in kilpse
;; color definitions in css rgba format
(def base-color [60 151 35 1])
(def overlays [[255 255 255 .23]
[255 255 255 .61]
[255 255 255 1]])
(require '[clojure.string :as s]
'[reagent.core :as reagent])

Apex architecture on documents, forms and modality

Motivation

During the execution of workflows at certain points information must be presented to the user and information must be gathered from the user. The actualy input method depends on the device that is used by a user, ranging from a web application to filling out a paper form.

The attributes of different devices are collected in “modalities” which describes a group of devices sharing common properties.

The data that shall be collected varies in shape and size, ranging from a single decision (“checkbox”) over what is a

(def base-resource-media-typed
{"application/json"
{:success false
:message "No acceptable resource available"}
"application/edn"
{:success false
:message "No acceptable resource available"}})
(def base-resource
{:handle-not-acceptable (media-typed base-resource-media-typed)
@ordnungswidrig
ordnungswidrig / README.md
Last active December 29, 2015 13:09 — forked from JoelBesada/README.md
Post current page to pinboard.in

This is an command for Backtick. It posts to current page's URL to pinboard.

@ordnungswidrig
ordnungswidrig / README.md
Last active December 29, 2015 13:09 — forked from JoelBesada/README.md
Post current page to pinboard with tag "friday"

This is a command for Backtick. It posts the current page to pinboard.

@ordnungswidrig
ordnungswidrig / gist:7021114
Created October 17, 2013 08:21
Avoid the if-let in liberator's exists?
(defn into-context [key value]
(when value
{ key value }))
(ANY "/choice" []
(resource :available-media-types ["text/html"]
:exists? (fn [ctx]
(into-context :choice
(get {"1" "stone" "2" "paper" "3" "scissors"}
(get-in ctx [:request :params "choice"]))))
@ordnungswidrig
ordnungswidrig / state-is-a-fold.clj
Created June 16, 2011 15:50
State is a fold over events
(ns state-is-a-fold
(:use clojure.test))
;;; After all, state is a fold of events. For example let's say the events are a sequence of numbers
;;; and we are folding by addition:
(deftest simple
(let [events [1 5 2 4 3]
state (reduce + events)]
(is (= 15 state))))
(print
(apply str (for [i (range 0 36)]
(format "%11s %2s %s\n"
(.toPlainString (.pow 2M i)) i (.toPlainString (.divide 1M (.pow 2M i)))))))
@ordnungswidrig
ordnungswidrig / liberator-flow.dot
Created September 11, 2012 23:14
Liberator flow chart
digraph {
node[shape="box", splines=ortho]
"start"[shape=circle];
"start" -> "service-available?"
"handle-multiple-representations" [peripheries=2];
"handle-ok" [peripheries=2];
"multiple-representations?" -> "handle-multiple-representations" [label = "true"]
"multiple-representations?" -> "handle-ok" [label="false"]
"handle-no-content" [peripheries=2];
"respond-with-entity?" -> "multiple-representations?" [label = "true"]
@ordnungswidrig
ordnungswidrig / liberator-decision-excerpt.clj
Created September 11, 2012 23:00
liberator decision syntax excerpt
(defdecision moved-temporarily? handle-moved-temporarily post-to-gone?)
(defdecision moved-permanently? handle-moved-permanently moved-temporarily?)
(defdecision existed? moved-permanently? post-to-missing?)