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
(defun ~/end-of-previous-face-change (face-name) | |
(save-excursion | |
(let ((continue t) | |
(answer nil)) | |
(while continue | |
(let ((p (or (previous-single-property-change (point) 'face) | |
1))) | |
(if (= p 1) | |
(progn | |
(setq continue nil) |
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
module Json.Decode.Generic where | |
import Json.Decode as Decode exposing (Decoder, (:=)) | |
import Array exposing (Array) | |
import Dict exposing (Dict) | |
type JsonValue = JsonNull | |
| JsonBool Bool | |
| JsonString String | |
| JsonFloat Float |
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
(require '[spec-provider.provider :as sp]) | |
(defn derive-specs [var & args] | |
(let [ns-sym (ns-name (:ns (meta var))) | |
ns-name (name ns-sym) | |
derived-specs (atom []) | |
fn-var-info (into [] (keep (fn [[var-sym var]] | |
(let [x (deref var)] | |
(when (fn? x) | |
[var var-sym x])))) |
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 if-not.bench | |
(:require [criterium.core])) | |
(defmacro if-not* | |
([test then] `(if ~test nil ~then)) | |
([test then else] | |
`(if ~test ~else ~then))) | |
(criterium.core/bench (if-not false 1 2)) | |
;; Evaluation count : 5375474880 in 60 samples of 89591248 calls. |
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
datomic.client.api | |
Synchronous client library for interacting with Datomic. | |
This namespace is a wrapper for datomic.client.api.async. | |
Functions in this namespace that communicate with a separate | |
process take an arg-map with the following optional keys: | |
:timeout Timeout in msec. |
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/lumo | |
(ns app.core | |
"This application watches the a directory <DIR> for screen shots | |
and applies an OCR to them (`tesseract`). The resulting text file is | |
saved to a directory called '<DIR>/OCR Screen Shots`.") | |
(def fs | |
(js/require "fs")) |
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 swap | |
"Swap the elements at positions `i` and `j` in `v`." | |
{:private true} | |
[v i j] | |
(-> v | |
(assoc i (get v j)) | |
(assoc j (get v i)))) | |
;; SEE: https://en.wikipedia.org/wiki/Heap%27s_algorithm | |
(defn permutations [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
def with_repl_friendly_inspect(&block) | |
x = block.call | |
case x | |
# We don't want to and sometimes can't override the #inspect method | |
# of these classes of values. | |
when Array, | |
Class, | |
FalseClass, | |
Hash, |
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 conform-case | |
(:require [clojure.spec :as spec])) | |
(defn build-clause-form | |
{:private true} | |
[expression-form clause else-form] | |
(let [[spec binding-form & body] clause] | |
`(let [conform-value# (spec/conform ~spec ~expression-form)] | |
(if (= conform-value# ::spec/invalid) |
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
(defun intero-scratch-send-paragraph () | |
(interactive) | |
(let* ((source-code-start (save-excursion | |
(backward-paragraph) | |
(point))) | |
(source-code-end (save-excursion | |
(forward-paragraph) | |
(point))) |