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
.collapsible button.collapsible-collapse-handle:after { | |
content: "►"; | |
} | |
.collapsible.collapsed button.collapsible-collapse-handle:after { | |
content: "▼"; | |
} | |
.collapsible .collapsible-collapse-handle { |
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
(define (atom? x) (not (pair? x))) | |
(define wrong 'wait) | |
(define the-false-value (cons "false" "boolean")) | |
(define (evaluate e env) | |
(if (atom? e) | |
(cond ((symbol? e) (lookup e env)) | |
((or (number? e) (string? e) (char? e) (boolean? e) (vector? e)) | |
e) | |
(else (wrong "Cannot evaluate" e))) |
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 cider-tooltip-source () | |
(interactive) | |
(let* ((sym (thing-at-point 'symbol)) | |
(response (cider-nrepl-send-sync-request | |
(list "op" "eval" | |
"code" | |
(format | |
"(do (require 'clojure.repl) (with-out-str (clojure.repl/source %s)))" | |
sym))))) | |
(when-let ((source (nrepl-dict-get response "value"))) |
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
while inotifywait -e modify -r . | |
make test | |
end |
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 app.main | |
(:require ["react-dom" :as rdom] | |
[helix.core :as hx :refer [defnc $ <>]] | |
[helix.dom :as d] | |
[helix.hooks :as hooks] | |
[clojure.core.async :as a :refer [go-loop]])) | |
(defnc greeting | |
"A component which greets a user." | |
[{:keys [name]}] |
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 ->Function | |
[f] | |
(reify java.util.function.Function | |
(apply [_ obj] (f obj)))) | |
(defn future-map | |
[cf f] | |
(.thenApply cf (->Function f))) | |
(defn future->ch | |
([cf] | |
(future->ch cf (async/chan 1) true)) |
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
(reify FileVisitor | |
(visitFile [_ p attrs] | |
(let [f (.relativize src p) | |
last-mod (Files/getLastModifiedTime p (make-array LinkOption 0))] | |
(when *verbose* (println (str (.toString src) "/" (.toString f)))) | |
(with-open [is (Files/newInputStream p (make-array OpenOption 0))] | |
(copy! (.toString f) is (.resolve dest (.toString f)) last-mod))) | |
FileVisitResult/CONTINUE) | |
(preVisitDirectory [_ p attrs] | |
(Files/createDirectories (.resolve dest (.toString (.relativize src p))) |
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
;; thanks ghadi from #clojure.beginners | |
(defn into-str | |
"reduce coll into a String, given a transducer" | |
[xf coll] | |
(transduce (comp xf (map str)) | |
(fn | |
([] (StringBuilder.)) | |
([^StringBuilder sb] (.toString sb)) | |
([^StringBuilder sb s] (.append sb ^String s))) |
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
(let (defcustoms) | |
(dolist (file (directory-files "/Users/dan/projects/dev/cider" t "\.el")) | |
(unless (string-match-p "dir-locals" file) | |
(with-current-buffer (find-file file) | |
(goto-char (point-min)) | |
(while (re-search-forward "defcustom" nil t) | |
(let ((custom (substring-no-properties (progn (paredit-forward 1) | |
(thing-at-point 'sexp)))) | |
(docstring (substring-no-properties (progn (paredit-forward 2) | |
(or (thing-at-point 'sexp) |
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
;; ‘C-x r s <register-key>’ save to register | |
;; 'C-c C-j x <register-key' to send to repl | |
(defun cider-insert-register-contents (register) | |
(interactive (list (register-read-with-preview "From register"))) | |
(let ((form (get-register register))) | |
;; could put form into a buffer and check if its parens are | |
;; balanced | |
(if form | |
(cider-insert-in-repl form (not cider-invert-insert-eval-p)) | |
(user-error "No saved form in register")))) |
OlderNewer