Folks and collectives within the clojure community who have extraordinary output and large collections of high quality libraries
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
Script |
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 partial-nth | |
"Takes a function f and position pos with one fewer than required args and | |
returns a fn that takes one argument which will be applied at pos (where pos | |
is 0 indexed ordinal position)" | |
[f pos & args] | |
(fn [x] | |
(let [[before after] (split-at pos args)] | |
(apply f (concat before [x] after))))) |
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 randw-nth | |
"As rand-nth but takes weight-fn applied to col to weight selection e.g. | |
(randw-nth [{:type :a :weight 3} | |
{:type :b :weight 1}] | |
:weight) | |
; => {:type :a :weight 3} is chosen 3/4 times" | |
[col weight-fn] | |
(let [weights (reductions + (map weight-fn col)) | |
choices (map vector col weights) |
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
{"name": "Test Board!", | |
"sounds": {"drip": "//tQZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAAAfAAAmFAAFBQUSEhIdHR0oKCgyMjIyPDw8R0dHUVFRXV1dXWdnZ3FxcXp6eoODg4yMjIyVlZWenp6mpqaurq6utra2vr6+xcXFzMzM19fX193d3eTk5Onp6ezs7Oz39/f5+fn5+fn5+fkAAAAsTEFNRTMuODIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/7EGQAD/AAAGkHAAAAAAANIOAAAAAAAaQUAAAAAAA0goAAAPGYC9fgM4NgjwucE4eKTCyP8TmBgDbT/GgFzAsgiH/i5w+MUuJ3LH/5oSZFDRAj//8cYsgnDQg5fL///4zBORzDSxmb//uQZCIAA3yGRIZCAABucQiAyMAADXTtOljFgAGwpWbXFmAA///+iTZuhkXJ83L5f/////K5FC4aLN3dM3NDM3NP/////////MC4aF83c38AsBkTwxgGW/EpjJ+IAEf+RMnhWn+MgT5Nlf/yqOeVz5Mf/mhfJs3lD//IgOA64yBDyJ///h8goAcAzZFyfUQAiH///m6zc0MCcIOXzdMz/////NycRTdBAvv5FCc/////////zQn1Msvm5cabpgoAAQgltQkH4X3MIiyWTHm9UWhxWS0CQiUforaOkuZqST1DhKHcPzV7PxNRHTmuXYfhnuf6zfo9Nsi2u2bDj84anikilhnsq+732/39LnUkIhpsrLhEy6cKFDqT2DJRZ0fb/DAUVvYpkF5WkAAVkCgbbSVBnRuJc1+YPYyXOfM2tWt3ucvMiHyEYfxGdzpjHet+fx4bH9w+s7W+PZ+YpGwQaFTSH7ayDRn+1hpxPXaA6naoxvnh8xv/8efbZ/r9TE4ofUX/LCNxoyGEmlOoUkIO//q//ygXQgAAmH+DGdFgfElv//uQZAW |
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
# -*- mode: snippet -*- | |
# name: hugsql-create-table | |
# key: create-table | |
# -- | |
-- :name create-$1-table | |
-- :command :execute | |
-- :return :raw | |
create table if not exists $1 ( | |
$2 | |
); |
shadow-cljs plays nicely with cider-nrepl courtesy of this little fella, however, not so much love for cider-nrepl's little brother refactor-nrepl.
Unfortunately there's no project agnostic way of loading nrepl middleware with
the nrepl launched by shadow-cljs
using user config alone (as stated here), but you can
ask nrepl to configure middleware for itself with ~/.nrepl/nrepl.edn
.
I have a working setup with the following (with shadow-cljs
> 0.2.39 and nrepl
0.6.0):
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
# Bind C-a to leader key | |
unbind C-a | |
set -g prefix C-a | |
bind C-a send-prefix | |
#set -g prefix C-Space | |
#bind C-Space send-prefix | |
# 0 is too far from ` ;) | |
set -g base-index 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
(defn get-thread-by-name | |
[thread-name] | |
(let [threads (keys (Thread/getAllStackTraces))] | |
(->> threads | |
(filter #(= thread-name (.getName %))) | |
(some identity)))) | |
;; You can then use the value to stop the thread: | |
(.stop (get-thread-by-name "server-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
(defn urandom | |
[n] | |
(with-open [in (io/input-stream (io/file "/dev/urandom"))] | |
(let [buf (byte-array n) | |
_ (.read in buf)] | |
buf))) |
OlderNewer