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 |
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 '[planck.shell :refer [sh]]) | |
(defn round-nth [s i] | |
(nth s (mod i (count s)))) | |
(let [to-open | |
(as-> *in* $ | |
(slurp $) |
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
(ns analyze.spit-sheets) | |
(import com.google.api.services.sheets.v4.SheetsScopes) | |
(require 'google-apps-clj.credentials) | |
(require '[google-apps-clj.google-sheets-v4 :as gs4]) | |
(def scopes [SheetsScopes/DRIVE SheetsScopes/SPREADSHEETS]) | |
(def creds (google-apps-clj.credentials/default-credential scopes)) | |
;(println (gd/list-files! creds "0BxDSmBQ-JH6xLTZ5R3psbkUzNEE")) | |
(def service (gs4/build-service creds)) |
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
;compile "ring:ring-core:1.5.0" | |
;compile "ring:ring-servlet:1.5.0" | |
;compile "ring:ring-defaults:0.2.1" | |
;compile "org.clojure:tools.nrepl:0.2.12" | |
;compile "org.clojure:clojure:1.8.0" | |
(require '[ring.util.servlet :as servlet]) | |
(defn merge-servlet-keys [request-map servlet-context request response] | |
(merge request-map |