Skip to content

Instantly share code, notes, and snippets.

View swannodette's full-sized avatar

David Nolen swannodette

View GitHub Profile
@swannodette
swannodette / FourteenBitCC.sc
Created August 4, 2020 09:44 — forked from carltesta/FourteenBitCC.sc
14-bit MIDI Handler for SuperCollider
FourteenBitCC {
/*
//Use Case:
MIDIIn.connectAll;
~x = FourteenBitCC.new("x", 72, 104);
~x.func = {|val| ("x: "++val).postln};
//MPE Example with Sensel Morph
MIDIIn.connectAll
(ns blog.errors.core
(:require-macros
[cljs.core.async.macros :refer [go]]
[blog.utils.macros :refer [<?]])
(:require
[cljs.core.async :refer [>! <! chan close!]]))
;; convert Node.js async function into a something
;; that returns a value or error on a channel
(defn run-task [f & args]
@swannodette
swannodette / om_data.cljs
Last active January 9, 2021 16:09
Om + DataScript
(ns om-data.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[datascript :as d]))
(enable-console-print!)
(def schema {})
(def conn (d/create-conn schema))
(defui Artist
static IQuery
(query [cl _]
[:db/id :artist/name])
Object
(render [{:keys [props]}]
(dom/div nil (:artist/name props))))
(defui ArtistList
static IQuery
(defn get-square [rows x y]
(for [x (range x (+ x 3))
y (range y (+ y 3))]
(get-in rows [x y])))
(defn init [vars hints]
(if (seq vars)
(let [hint (first hints)]
(all
(if-not (zero? hint)
@swannodette
swannodette / gist:997140
Created May 28, 2011 19:26
type-inf.clj
(ns logic.y
(:refer-clojure :exclude [== reify inc])
(:use [clojure.core.logic minikanren prelude
nonrel match]))
(defna findo [x l o]
([_ [[?y :- o] . _] _]
(project [x ?y] (== (= x ?y) true)))
([_ [_ . ?c] _] (findo x ?c o)))

SuperCollider Byte Code Reference

Brian Heim 2018-06-19

Table of Contents

  • Introduction
@swannodette
swannodette / transitive_foreign.md
Last active June 1, 2020 14:22
Transitive Foreign Dependencies
NOTE: This proposal is dead. A simpler solution was arrived at via the new `:bundle` target.

ClojureScript Support for Foreign Libraries via NPM

Problem Description

The current Webpack solution works reasonable well for application oriented development, but does not address the wider issue of developing ClojureScript libraries that depend on the wider JavaScript ecosystem where the artifacts do not reside in Java-centric distrubtion like Maven (i.e. NPM). Currently a ClojureScript library cannot express these kinds of foreign library dependencies at all. Thus users must constantly redefine basic dependencies from NPM such as React, boilerplate Webpack configuration, boilerplate import/export files, and thus cannot create and share reusable ClojureScript components that depend on this vast ecosystem.

@swannodette
swannodette / cljs_deps2.md
Last active April 11, 2020 00:58
Transitive Foreign Dependencies 2

Add a new :target option, :bundle. When this target is set :nodejs is true and :nodejs-rt is false. We want to take advantage of the fact that the :nodejs target emits Node.js require for libs found in node_modules. :nodejs-rt false clarifies that we are not actually going to target the Node.js runtime.

The :bundle target always generates an index.js file, it need only be created once.

The contents of index.js looks like the following:

@swannodette
swannodette / linnstrument.sc
Created April 2, 2019 18:26 — forked from kisielk/linnstrument.sc
Linnstrument + Supercollider
(
var notes, synths, on, off, mod, bend, touch;
~num_channels = 8;
~bend_range = 24;
MIDIIn.connectAll;
notes = Array.newClear(~num_channels);
synths = Array.newClear(~num_channels);