- Model: Prusa MK3S
- Serial number: CZPX2020X004XK87556
- E3D Revo 6 hotend (fully loaded edition)
- Nylock mod for precise bed levelling
- Raspberry Pi (model 3), 4 inch hyperpixel touch display, Raspberry Pi camera
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)) |