This file contains hidden or 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 manico.utils.fs-watch | |
(:require [clojure.set :as set] | |
[lwjgl-spike.utils.interop :as interop]) | |
(:import [java.nio.file Paths WatchEvent$Kind | |
StandardWatchEventKinds])) | |
(def ^:private keywords->event-kinds | |
{:create StandardWatchEventKinds/ENTRY_CREATE | |
:modify StandardWatchEventKinds/ENTRY_MODIFY | |
:delete StandardWatchEventKinds/ENTRY_DELETE}) |
This file contains hidden or 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
# Source this thing from bash | |
trap 'preexec_invoke_exec' DEBUG | |
preexec () { :; } | |
preexec_invoke_exec () { | |
[ -n "$COMP_LINE" ] && return # do nothing if completing | |
[ "$BASH_COMMAND" = "$PROMPT_COMMAND" ] && return # don't cause a preexec for $PROMPT_COMMAND | |
local this_command=`history 1 | sed -e "s/^[ ]*[0-9]*[ ]*//g"`; | |
preexec "$this_command" |
This file contains hidden or 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 this-is-good [] | |
(println "GOOD")) | |
(def foo \") | |
(defn this-is-wrong [] | |
(println foo)) |
This file contains hidden or 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.promise-ring | |
(:require-macros [cljs.core.async.macros :refer [go go-loop]]) | |
(:require | |
[cljs.core.async :refer [promise-chan put! <! chan close!] :as async])) | |
; You Only Put Once | |
; YOPO | |
(enable-console-print!) |
This file contains hidden or 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
;; Async Lifecycle | |
(defn lifecycle-channel [component] | |
(.-lifecycleChannel component)) | |
(defn with-lifecycle [klass] | |
(let [ch (async/chan) | |
handle (fn [event] | |
(fn [& args] | |
(async/put! ch event) |
This file contains hidden or 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
;; Produces maps from let-like bindings. And yes: we are not proud of this. | |
(defmacro bindmap [bindings] | |
`(let [~@bindings] | |
~(reduce | |
(fn [m# [binding-form# _#]] | |
(let [binding-symbol# (cond | |
(map? binding-form#) | |
(:as binding-form#) |
OlderNewer