Skip to content

Instantly share code, notes, and snippets.

View swannodette's full-sized avatar

David Nolen swannodette

View GitHub Profile
@bhauman
bhauman / compiler-options-schema.clj
Last active August 8, 2017 21:19
A Schema for ClojureScript Options
(ns cljs.compiler-options-schema
(:require
[clojure.spec :as s]
[clojure.string :as string]
;; for initial dev
[clojure.test :refer [deftest is testing]]))
(defn non-blank-string? [x] (and (string? x) (not (string/blank? x))))
(defonce ^:private registry-ref (atom {}))
@kisielk
kisielk / linnstrument.sc
Last active July 20, 2023 18:18
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);
(ns test.rec
(:require [om.next :as om :refer-macros [defui]]
[goog.dom :as gdom]
[om.dom :as dom]))
(enable-console-print!)
(def app-state
{:display/path []
:tree/root
@bensu
bensu / var-expr.clj
Created July 19, 2015 18:14
Var naming for cljs-1343 refactoring
;; 1 - The var associated to a def, (def my-var ...) - L1142
(DefExpr. :def env form var-name
;; TODO: check if this map should be a VarExpr - Sebastian
(assoc (analyze (-> env (dissoc :locals)
(assoc :context :expr)
(assoc :def-var true))
sym)
:op :var)
doc (:jsdoc sym-meta) init-expr
@swannodette
swannodette / reactpersist.md
Created May 28, 2015 19:17 — forked from chenglou/gist:34b155691a6f58091953
Persistent React Component Problem

key is pretty much crucial for state perservation in React. As of React 0.13 it can't do the following things:

  • Clone state
<Comp key={1} /><Comp key={1} />
  • Preserve component state across different parents:
@mfikes
mfikes / podfiles.md
Created May 20, 2015 21:40
Ejecta podfiles

This links:

platform :ios, '8.0'
pod 'Ambly', :git => 'https://github.com/mfikes/ambly', :branch => 'jsc-c-api'
pod 'Ejecta', :git => 'https://github.com/swannodette/Ejecta', :branch => 'podspec'

Below uses my fork of your Ejecta, and also links. I mucked with getting rid of the JavaScriptCore framework and renaming the static lib so it can be included. (This works, but it is not clear if needed over just using your fork).

@mfikes
mfikes / progress.md
Last active August 29, 2015 14:21
JSC C API

In Ambly, created a new branch jsc-c-api.

In that branch, switched everything over to use JSGlobalContextRef, JSValueRef, but actually commented out most of the implementation in each of the methods, except for one tiny bit in ABYServer, where REPL-generated JavaScript is executed. I converted that over to a C-based approach:

    // Evaluate the JavaScript
    JSValueRef jsError = NULL;
    JSStringRef javaScriptStringRef = JSStringCreateWithCFString((__bridge CFStringRef)javaScript);
    JSValueRef result = JSEvaluateScript(_jsContext, javaScriptStringRef, NULL, NULL, 0, &jsError);
    JSStringRelease(javaScriptStringRef);
Pod::Spec.new do |s|
s.name = 'Ejecta'
s.version = '1.5'
s.license = 'MIT'
s.summary = 'A Fast, Open Source JavaScript, Canvas & Audio Implementation for iOS.'
s.homepage = 'http://impactjs.com/ejecta'
s.author = { 'Dominic Szablewski' => 'dominic.szablewski@gmail.com' }
s.source = { :git => 'https://github.com/phoboslab/Ejecta.git', :tag => 'v1.5' }
s.description = 'A Fast, Open Source JavaScript, Canvas & Audio Implementation for iOS.'
s.platform = :ios
;; Gamma (shader-generation): https://github.com/kovasb/gamma
;; Gamma Driver (WebGL resource management, aka "Om for WebGL"): https://github.com/kovasb/gamma-driver
;; Gamma examples: https://github.com/kovasb/gamma-examples
(ns gampg.learn-gamma.lesson-01
(:require [clojure.string :as s]
[gamma.api :as g]
[gamma.program :as p]
[gamma.tools :as gt]
[gamma-driver.drivers.basic :as driver]
(ns ptv.scratch
(:require
[om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]))
(enable-console-print!)
(def app-state (atom {}))
(defn component-one [data owner opts]