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 render.format) | |
(defn standardize [form] | |
(cond | |
(vector? form) | |
(let [[k m & rest] form] | |
(if (map? m) | |
(vec (list* k m (map standardize rest))) | |
(vec (list* k {} (standardize m) (map standardize rest))))) | |
(seq? form) |
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 |
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
import { FaCamera, FaImage, FaArrowLeft } from 'react-icons/lib/fa'; | |
import * as $ from 'jquery'; | |
export const modal = (id: string, title: string, body: object, footer?: object) => ( | |
<div className="modal fade" id={id} role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> | |
<div className="modal-dialog" role="document"> | |
<div className="modal-content"> | |
<div className="modal-header"> | |
<h5 className="modal-title" id="exampleModalLabel">{title}</h5> | |
<button type="button" className="close" data-dismiss="modal" aria-label="Close"> |
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
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
#!/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
(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
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
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]; |