I hereby claim:
- I am oliyh on github.
- I am oliyh (https://keybase.io/oliyh) on keybase.
- I have a public key ASBqyXdQrYvjtU8IfcLNJC61cKYjatjbrLgEHYEarpwVvgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
(import '[java.util Timer TimerTask]) | |
(defn debounce | |
([f] (debounce f 1000)) | |
([f timeout] | |
(let [timer (Timer.) | |
task (atom nil)] | |
(with-meta | |
(fn [& args] | |
(when-let [t ^TimerTask @task] |
(require '[re-frame.core :as re-frame]) | |
(require '[reagent.ratom :as reagent]) | |
(require '[re-graph.core :as re-graph]) | |
(require '[martian.re-frame :as martian]) | |
;; handler for storing things when they arrive | |
(re-frame/reg-event-db | |
::on-things | |
(fn [db [_ things]] | |
(assoc db ::raw-things things))) |
(defn comp->> | |
"Like comp but multiple arguments are passed to all functions like partial, except the last which is threaded like ->>" | |
[f & fs] | |
(fn [& args] | |
(reduce (fn [r f'] | |
(apply f' (conj (into [] (butlast args)) r))) | |
(apply f args) | |
fs))) | |
(defn comp-> |
(ns model | |
(:require [re-frame.core :as re-frame])) | |
(re-frame/def-event ::toggle-sort-direction [] | |
(fn [db _] | |
(update db :sort-asc? not))) | |
(re-frame/def-sub ::sort-asc? | |
(fn [db _] | |
(get db :sort-asc? true))) |
(require '[clj-http.client :as http]) | |
(require '[clojure.core.async :as a]) | |
(require '[clojure.string :as string]) | |
(require '[clojure.java.io :as io]) | |
(import '[java.io InputStream]) | |
(def event-mask (re-pattern (str "(?s).+?\r\n\r\n"))) | |
(defn- parse-event [raw-event] | |
(->> (re-seq #"(.*): (.*)\n?" raw-event) |
// hard won knowledge from http://stackoverflow.com/questions/20035615/using-raw-image-data-from-ajax-request-for-data-uri | |
var xmlHTTP = xhr.XMLHttpRequest(); | |
xmlHTTP.open('GET', url, true); | |
xmlHTTP.responseType = 'arraybuffer'; | |
xmlHTTP.onload = function(e) { | |
var arr = new Uint8Array(this.response); | |
var raw = String.fromCharCode.apply(null,arr); | |
var b64 = base64.encode(raw); | |
var dataURL="data:image/png;base64," + b64; | |
}; |
(swagger/defafter async-handler | |
{:description "Wraps asynchronous responses into the context (lets you use defhandler)"} | |
[context] | |
(if (satisfies? clojure.core.async.impl.protocols/Channel (:response context)) | |
(a/pipe (:response context) (a/chan 1 (map #(assoc context :response %)))) | |
context)) |
{"swagger":"2.0","info":{"title":"Swagger API","version":"0.0.1"},"produces":["application/json"],"consumes":["application/json"], | |
"paths":{"/ab":{"get":{"parameters":[{"in":"body","name":"SchemaB","description":"","required":true,"schema":{"$ref":"#/definitions/SchemaA"}}]," | |
responses":{"default":{"description":""}}}}, | |
"/cb":{"get":{"parameters":[{"in":"body","name":"SchemaB","description":"","required":true,"schema":{"$ref":"#/definitions/SchemaC"}}], | |
"responses":{"default":{"description":""}}}}}, | |
"definitions":{"SchemaA":{"type":"object","properties":{"a":{"type":"string"}},"required":["a"]}, |