Skip to content

Instantly share code, notes, and snippets.

Avatar

David Nolen swannodette

View GitHub Profile
@swannodette
swannodette / FourteenBitCC.sc
Created Aug 4, 2020 — forked from carltesta/FourteenBitCC.sc
14-bit MIDI Handler for SuperCollider
View FourteenBitCC.sc
FourteenBitCC {
/*
//Use Case:
MIDIIn.connectAll;
~x = FourteenBitCC.new("x", 72, 104);
~x.func = {|val| ("x: "++val).postln};
//MPE Example with Sensel Morph
MIDIIn.connectAll
View bytecodes.md

SuperCollider Byte Code Reference

Brian Heim 2018-06-19

Table of Contents

  • Introduction
@swannodette
swannodette / cljs_deps2.md
Last active Apr 11, 2020
Transitive Foreign Dependencies 2
View cljs_deps2.md

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 / transitive_foreign.md
Last active Jun 1, 2020
Transitive Foreign Dependencies
View transitive_foreign.md
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 / linnstrument.sc
Created Apr 2, 2019 — forked from kisielk/linnstrument.sc
Linnstrument + Supercollider
View linnstrument.sc
(
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);
View twister-example.scd
// Twister devices are expected to be named in this form:
// classvar <endpointDevice="Midi Fighter Twister %", <endpointName="Midi Fighter Twister";
// Where "Midi Fighter Twister 1" is TwisterDevice(\default) and "Midi Fighter Twister 2" is TwisterDevice(\secondary)
// A twister device. These are singletons - there is only ever one registered per device. It works ala Ndef, Pdef, etc, see Singleton help file.
~device = TwisterDevice(\default);
// If your MIDI Fighter is named something other than the above, you can register it via:
this.registerDevice(\myDevice, "endpoint device", "endpoint name");
// And then access it via TwisterDevice(\myDevice)
View Twister.sc
DummyMIDI {
var dummy = 0;
*new {
^super.newCopyArgs();
}
noteOn {}
noteOff {}
control {}
@swannodette
swannodette / core.cljs
Last active Jul 13, 2018
Figwheel :paths bug
View core.cljs
;; src/cljs/hello_world/core.cljs
(ns hello-world.core)
(println "Hello, world!")
View deps.edn
("goog.debug.Error"
"goog.dom.NodeType"
"goog.string"
"goog.asserts"
"goog.reflect"
"goog.object"
"goog.math.Integer"
"goog.string.StringBuffer"
"goog.array"
"goog.math.Long"
View code_splitting_guide.md

Code Splitting

NOTE: This gist uses the master branch of ClojureScript. Clone ClojureScript and from the checkout run ./script/bootstrap and ./script/uberjar. This will produce target/cljs.jar which you can use to follow this guide.

As client applications become larger it becomes desirable to load only the code actually required to run a particular logical screen. Previously ClojureScript :modules compiler option permitted such code splitting, but this feature only worked under :advanced compilation and users would still have to manage loading these splits. :modules also required manual

You can’t perform that action at this time.