This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; 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"}}}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defn get-free-port [] | |
| (with-open [socket (java.net.ServerSocket. 0)] | |
| (.getLocalPort socket))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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 [_])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; 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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {:name "Search the Clojurians Slack-archive" | |
| :author "Gert Goet" | |
| :license "MIT"} | |
| ;;--- | |
| (when-some [q (js/prompt "Search the Clojurians Slack-archive:")] | |
| (.open js/window (str "https://clojurians.zulipchat.com/#narrow/stream/180378-slack-archive/search/" q))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bb | |
| (doseq [line (->> (file-seq (clojure.java.io/file (System/getenv "PWD"))) | |
| (filter #(.isFile %)) | |
| (filter (fn [f] (contains? #{"clj" "cljc" "cljs" "bb"} | |
| (last (clojure.string/split (.getName f) #"\."))))) | |
| (mapcat #(clojure.string/split-lines (slurp %))) | |
| sort | |
| )] | |
| (println line)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; Like https://github.com/ltratt/multitime but with the power of Clojure: multi-processor, shuffling, advanced statistics | |
| ;; export BABASHKA_CLASSPATH=$(clojure -Sdeps '{:deps {org.clojure/data.generators {:mvn/version "1.0.0"}, org.clojure/math.combinatorics {:mvn/version "0.1.6"}}}' -Spath) | |
| (do | |
| (require '[clojure.math.combinatorics :as combo] | |
| '[clojure.data.generators :as gen]) | |
| (let [binaries ["../sci/tmp/sci-25ace7c" | |
| "../sci/tmp/sci-3c01531" | |
| "../sci/tmp/sci-6c8852d"] |
NewerOlder