Skip to content

Instantly share code, notes, and snippets.

Devin Walters devn

  • Outpace Inc.
  • Madison, WI
Block or report user

Report or block devn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@devn
devn / clojure_zippers.clj
Last active Sep 11, 2019
clojure zippers, returning a path that can be used with update-in or get-in, has alternate versions of update-in and assoc-in which work with clojure sets
View clojure_zippers.clj
(require '[clojure.zip :as z])
(defn update-in*
"Like update-in, but also works with nested sets."
[m ks f & args]
(let [up (fn up [m ks f args]
(let [[k & ks] ks]
(if ks
(if (set? m)
(conj (disj m k) (up (get m k) ks f args))
View coinstar.clj
(ns coinstar
(:import [java.time LocalDate]))
(def working? (constantly false))
(defn go
"Provided a `who` and `when`, returns the state of
a coinstar `when` the `who` goes to it.
Example:
@devn
devn / todo.exs
Last active Dec 1, 2017
do todo
View todo.exs
defmodule Do do
def dont think, about, it, but, please do
[think, about, it, please]
end
end
Do.dont :worry, :about, :grouping, :any, :arguments
=> [:worry, :about, :grouping, :arguments]
@devn
devn / strum.clj
Created Dec 24, 2016 — forked from noprompt/strum.clj
Macro for defining instrumented functions which verify their arguments and return values against specs.
View strum.clj
(ns strum.core
(:refer-clojure :exclude [defn])
(:require
[clojure.spec :as spec]
[clojure.spec.test :as spec.test]))
;; ---------------------------------------------------------------------
;; Prelude
;; HACK: Currently, as of Clojure 1.9.0-alpha14, there is a bug with
View keybase.md

Keybase proof

I hereby claim:

  • I am devn on github.
  • I am devn (https://keybase.io/devn) on keybase.
  • I have a public key whose fingerprint is F782 0ED3 7BE8 3639 1130 3C76 EB31 8EE6 4426 0178

To claim this, I am signing this object:

@devn
devn / recursive-transient-persistent-transform.clj
Last active Nov 10, 2019
Recursively transform a nested map into transients, and then back to persistents
View recursive-transient-persistent-transform.clj
(require '[clojure.walk :as walk])
;; => nil
(defn transient? [x]
(instance? clojure.lang.ITransientCollection x))
;; => #'user/transient?
(let [transients (walk/postwalk (fn [x]
(if (map? x)
(transient x)
@devn
devn / midijam.clj
Created Sep 4, 2015
playing midi notes from overtone to ableton, reason, etc. using MIDI Patchbay
View midijam.clj
;; http://notahat.com/midi_patchbay/
;; Create a virtual input and virtual output in MIDI patchbay
;; input name: "Overtone"
;; output name: "yourchoice"
;; In Reason, Ableton, etc. select "yourchoice"
;; as the midi input for a channel.
(ns jam.core
(:use [overtone.live]))
@devn
devn / cheating.clj
Created Sep 5, 2014
Implementing IFn
View cheating.clj
(defn gen-nonvariadic-invokes [f]
(for [arity (range 1 21),
:let [args (repeatedly arity gensym)]]
`(~'invoke [~@args] (~f ~@args))))
(defn gen-variadic-invoke [f]
(let [args (repeatedly 22 gensym)]
`(~'invoke [~@args] (apply ~f ~@args))))
(defn gen-apply-to [f]
@devn
devn / autotune.clj
Created Jul 15, 2014
autotune/autocorrect pitch overtone
View autotune.clj
(defsynth pitch-follow-1 []
(let [in (mix [(sound-in)])
amp (amplitude:kr in 0.05 0.05)
[freq has-freq] (pitch:kr in
:amp-threshold 0.02
:median 7)
out-1 (mix [(var-saw:ar (mul-add:ar 0.5 1 2)
0
(lf-noise1:kr (mul-add:kr 0.3 0.1 0.1)))])
out-2 (loop [n 6
View init.el
;;
;; paths
;;
(setq system-uses-terminfo nil)
(add-to-list 'exec-path (expand-file-name "~/bin"))
(add-to-list 'exec-path (expand-file-name "/usr/local/bin"))
(setenv "PATH" (concat (expand-file-name "~/bin")
":/usr/local/bin:"
You can’t perform that action at this time.