This file contains 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
#!/opt/homebrew/bin/planck | |
(require '[planck.core :refer [*in* slurp]]) | |
(require '[clojure.string :as string]) | |
(require '[cljs.reader :refer [read-string]]) | |
(def in (slurp *in*)) | |
(def subsections | |
(map second | |
(re-seq #"d=\"([^\"]+)" in))) |
This file contains 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
is_debug = false # To get a release build | |
target_cpu = "arm64" | |
v8_target_cpu = "arm64" | |
is_clang = false # To build with GCC instead of clan | |
treat_warnings_as_errors = false | |
is_component_build=true | |
use_custom_libcxx=false |
This file contains 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
;; deploy to clojars | |
{:auth {:repository-auth {#"clojars" {:username "whamtet" :password "app-pw"}}} | |
;; then go lein deploy clojars |
This file contains 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 flatten-all [m] (->> m (tree-seq coll? seq) (remove coll?))) |
This file contains 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- pluralize [todo last-num done] | |
(if (empty? todo) | |
done | |
(let [[f & r] todo] | |
(recur | |
r | |
(if (number? f) f last-num) | |
(conj done | |
(if (coll? f) | |
((if (= 1 last-num) first second) f) |
This file contains 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
var files; | |
htmx.defineExtension('file', { | |
onEvent: function(type, evt) { | |
if (type === 'htmx:beforeSwap') { | |
files = htmx.findAll(evt.target, 'input[type="file"]'); | |
} | |
if (type === 'htmx:afterSwap') { | |
for (file of files) { | |
const target = document.getElementsByClassName(file.className)[0]; |
This file contains 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
sudo ifconfig lo0 alias 127.0.0.2 |
This file contains 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 next-prime | |
([] (concat [2 3] (next-prime [2 3]))) | |
([primes] | |
(loop [candidate (-> primes peek (+ 2))] | |
(if (->> primes | |
(take-while #(<= % (Math/sqrt candidate))) | |
(some #(zero? (mod candidate %)))) | |
(recur (+ candidate 2)) | |
(lazy-seq (cons candidate (next-prime (conj primes candidate)))))))) |
This file contains 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/local/bin/planck | |
(require '[planck.core :refer [*in* slurp]]) | |
(require '[planck.shell :refer [sh]]) | |
(->> "ifconfig" | |
sh | |
:out | |
(re-find #"inet (192\S+)") | |
second | |
(sh "pbcopy" :in)) |
This file contains 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
using clojure.lang; | |
IFn load = clojure.clr.api.Clojure.var("clojure.core", "load-string"); | |
load.invoke("(clojure.core.server/start-server {:port 5555 :name \"repl\" :accept 'clojure.core.server/repl})" + | |
"(println \"serving!\")"); | |
// telnet localhost 5555 |