Skip to content

Instantly share code, notes, and snippets.

View galdre's full-sized avatar

Timothy S. Dean galdre

View GitHub Profile
@galdre
galdre / gmail-github-filters.md
Created December 20, 2023 17:16 — forked from ldez/gmail-github-filters.md
Gmail and GitHub - Filters

Gmail and GitHub

How to filter emails from GitHub in Gmail and flag them with labels.

The labels in this document are just examples.

Pull Request

Filter Label
@galdre
galdre / transit-bug.cljs
Created May 14, 2019 16:55
transit-cljs bug with multiple-arity reader functions
(ns transit-bug
(:require [cognitect.transit :as t]))
;; We will use the official documentation as a base.
;; https://github.com/cognitect/transit-cljs/wiki/Getting-Started
;;;;;;;;;;;;;;;;;;;;;;;;
;; WRITING CUSTOM VALUES
;; The following is copy-pasted directly from the tutorial:
@galdre
galdre / script.clj
Created March 11, 2019 21:01
Clojure shell scripts
#!/usr/bin/env sh
#_(
DEPS='
{:deps
{org.clojure/clojure {:mvn/version "1.10.0"}
}}
'
exec clojure -Sdeps "$DEPS" "$0" "$@"
exit 1
)
@galdre
galdre / *cider-repl*
Created March 10, 2019 15:16
Data Reader Issue
data-reader-issue.core> my-type
#SillyType[data-reader-issue.core/my-type]
data-reader-issue.core> #SillyType[data-reader-issue.core/my-type]
2. Unhandled clojure.lang.Compiler$CompilerException
Error compiling *cider-repl programming/data-reader-issue:localhost:33489(clj)* at (0:0)
#:clojure.error{:phase :compile-syntax-check,
:line 0,
:column 0,
(ns telephone.core
(:import [java.util UUID]))
(def ^:dynamic *number-of-errors* 100)
(def ^:dynamic *error-rate* 0.75)
(def ^:dynamic *common-error-rates* (repeat 10 0.2))
(def ^:dynamic *healing-rate* 0.05)
(def ^:dynamic *combine-healing-rate* 0.75)
;; {::errors #{}}
@galdre
galdre / toys.clj
Created April 4, 2018 14:14
clojure.core extensions & experiments
(:import [clojure.lang MapEntry]
[java.util PriorityQueue]
[java.util.concurrent ForkJoinPool ForkJoinTask])
(defn untwine
"Returns a lazy sequence of n lazy lists, where each list contains
every nth item of the input collection. The n lists do not overlap,
and together they are covering.
=> (untwine 3 (range 10))
((0 3 6 9) (1 4 7) (2 5 8))"
(defn evict
"Returns a new map of the same (hashed/sorted) type, consisting of target with
all of the items of key-coll dissociated. A transducer may be supplied. It is the
`outfrom` to Clojure's `into`."
([target key-coll]
(persistent! (reduce dissoc! (transient target) key-coll)))
([target xform coll]
(persistent! (transduce xform (completing dissoc!) (transient target) coll))))

Keybase proof

I hereby claim:

  • I am galdre on github.
  • I am galdre (https://keybase.io/galdre) on keybase.
  • I have a public key ASBHkd6ExVreEJW4hdo_q-EUfWoDqLUF3JbD8DBK8DWC1wo

To claim this, I am signing this object:

@galdre
galdre / zipducers.clj
Created June 15, 2017 19:00
Better map processing
(import '[clojure.lang MapEntry])
;; Sometimes you want to pass a map through a pipeline that modifies keys here,
;; values there, or both, or sometimes neither, or whatever, and get a map out
;; at the end. But recreating the map structure after each step (as does
;; plumatic/plumbing) is wasteful. These transducers work with MapEntry sequences
;; and return MapEntry sequences.
(defn zip
"Returns a MapEntry sequence with the keys zipped to the values.