Skip to content

Instantly share code, notes, and snippets.

@tggreene
tggreene / hugsql-create-table
Last active November 3, 2019 19:25
yas-snippets for hugsql
# -*- mode: snippet -*-
# name: hugsql-create-table
# key: create-table
# --
-- :name create-$1-table
-- :command :execute
-- :return :raw
create table if not exists $1 (
$2
);
@tggreene
tggreene / basic-sounds.json
Last active December 8, 2018 17:59
Airhorn #1
{"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
@tggreene
tggreene / Authors.md
Last active October 19, 2018 14:00
Clojure Library Authors
@tggreene
tggreene / randw-nth.clj
Created October 2, 2018 13:21
randw-nth #clojure
(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)
@tggreene
tggreene / partial-nth.clj
Created October 2, 2018 13:19
partial-nth #clojure
(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)))))
@tggreene
tggreene / Backtick_Test
Last active December 31, 2015 09:39 — forked from JoelBesada/README.md
Script