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 draggable [] | |
(let [pos (atom [0 0])] | |
(reagent/create-class | |
{:render | |
#(let [[x y] @pos] | |
[:div.d {:style {:transform (str "translate(" x "px," y "px)")}} | |
"I can be dragged"]) | |
:component-did-mount | |
(fn [this] |
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
(defmacro evil-helper-cider-make-debug-command (&rest cider-commands) | |
"Make functions that wrap `cider-debug' commands. | |
Cider debug commands are sent through | |
`cider-debug-mode-send-reply'. ex. \(cider-debug-mode-send-reply | |
\":next\"\)" | |
(let ((commands (if (consp cider-commands) | |
cider-commands | |
(list cider-commands)))) | |
`(progn | |
,@(cl-loop |
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 my-api.handler | |
(:require [compojure.core :refer :all] | |
[ring.util.response :refer [response status content-type]] | |
[ring.middleware.params :refer [wrap-params]] | |
[ring.middleware.keyword-params :refer [wrap-keyword-params]] | |
[ring.middleware.json :refer [wrap-json-response wrap-json-body]])) | |
(defroutes app-routes | |
(context "/v1" [] | |
(GET "/" req |
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
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) | |
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) | |
;; minimally, install use-package | |
(unless (package-installed-p 'use-package) | |
(package-refresh-contents) | |
(package-install 'use-package)) | |
(blink-cursor-mode -1) | |
(tool-bar-mode -1) |
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
;; DEPRECATED - see https://pitch-io.slack.com/archives/CBKNRBRHA/p1630054796006400 | |
(defvar bulk-saved-attachments-dir (expand-file-name "~/Documents/mu4e")) | |
(defun cleanse-subject (sub) | |
(replace-regexp-in-string | |
"[^A-Z0-9]+" | |
"-" | |
(downcase sub))) |
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
(defmacro condev | |
"Takes clauses in the same style as `cond` but, if the left side is | |
truthy, will execute the right side of the expressions as a function | |
which gets the result of evaluation of the left side." | |
[& clauses] | |
(assert (even? (count clauses))) | |
(let [pstep (fn [[test step]] `(when-let [r# ~test] (~step r#)))] | |
`(list ~@(map pstep (partition 2 clauses))))) |
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/bin/env bash | |
time="${1}" | |
if [[ -z ${time} ]]; then | |
echo "Need a time to ring!" >&2 | |
exit 1 | |
fi | |
echo "DISPLAY=:0 xmessage alarm" | at ${time} |
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
function export-emacs { | |
if [ "$(emacsclient -e t)" != 't' ]; then | |
return 1 | |
fi | |
for name in "${@}"; do | |
value=$(eval echo \"\$${name}\") | |
emacsclient -e "(setenv \"${name}\" \"${value}\")" >/dev/null | |
done | |
} |