CAD03 is the binary data format underlying the lattice of Convex. This a first version of a partial decoder in Clojure and Javascript (via Squint)
More information on the format here https://docs.convex.world/docs/cad/encoding
| (require '[babashka.fs :as fs]) | |
| (import '[io.methvin.watcher.visitor FileTreeVisitor]) | |
| (defn walker-file-tree [& {:as opts}] | |
| (fn [path {:keys [on-file on-dir on-failure] | |
| :or {on-file (fn [_ _]) | |
| on-dir (fn [_ _]) | |
| on-failure (fn [_ _])}}] | |
| (fs/walk-file-tree path | |
| (merge {:pre-visit-dir |
| ;; Try with deps-try org.babashka/sci 0.13.52 (see https://github.com/eval/deps-try) | |
| ;; The following takes 6 seconds on my machine | |
| (time | |
| (re-matches #"^(.*a){20}$" (str (apply str (repeat 28 \a)) "!"))) | |
| ;; With Sci's new :interrupt-fn feature we can make regexp's safer: | |
| (require '[sci.ctx-store :as store] | |
| '[sci.core :as sci] |
CAD03 is the binary data format underlying the lattice of Convex. This a first version of a partial decoder in Clojure and Javascript (via Squint)
More information on the format here https://docs.convex.world/docs/cad/encoding
| ;; Follow up of https://gist.github.com/jeroenvandijk/cb5f3411943c24dc68b225f34a3e474b | |
| ;; | |
| ;; Now trying to use reitit.openapi still some work in muuntaja.format.json or maybe the json part can be done differently | |
| ;; | |
| ;; Run this script with `bb bb_reitit_demo_openapi.clj` and visit http://localhost:3000/openapi.json | |
| (require '[babashka.deps :as deps]) | |
| (deps/add-deps '{:deps {metosin/reitit {:mvn/version "0.9.2"}}}) |
| ;; TODO create a PR to Reitit to add some `:bb` conditionals | |
| ;; | |
| ;; Run this script with `bb reitit_demo.clj` and visit http://localhost:3000 | |
| (require '[babashka.deps :as deps]) | |
| (deps/add-deps '{:deps {metosin/reitit {:mvn/version "0.9.2"}}}) | |
| ;; --- START Reitit monkey patch |
| (defn get-free-port [] | |
| (with-open [socket (java.net.ServerSocket. 0)] | |
| (.getLocalPort socket))) |
| (ns malli.inline-output | |
| (:require | |
| [edamame.core :refer [parse-string]] | |
| [malli.core :as m] | |
| [malli.error :as me])) | |
| ;; -- helper code to find location data in an edn file | |
| (defprotocol IUnwrap | |
| (unwrap [_])) |
| ;; When middleware comes with a certain dependency order things get a bit tedious and error prone. | |
| ;; Consider example 1 below: | |
| (defn add-cmd [req cmd] | |
| (update req :cmd (fnil conj []) cmd)) | |
| (defn add-cmd-handler [cmd] | |
| (fn [req] |
| ;; Copy of https://gist.github.com/alandipert/1263783 | |
| ;; | |
| ;; Copyright (c) Alan Dipert. All rights reserved. | |
| ;; The use and distribution terms for this software are covered by the | |
| ;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) | |
| ;; By using this software in any fashion, you are agreeing to be bound by | |
| ;; the terms of this license. | |
| ;; You must not remove this notice, or any other, from this software. | |
| (ns alandipert.kahn |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" | |
| "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>Label</key> | |
| <string>com.plex.pms</string> | |
| <key>OnDemand</key> | |
| <false/> | |
| <key>ProgramArguments</key> |