Skip to content

Instantly share code, notes, and snippets.

View swannodette's full-sized avatar

David Nolen swannodette

View GitHub Profile
@swannodette
swannodette / podfiles.md
Last active August 29, 2015 14:21 — forked from mfikes/podfiles.md

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).

@swannodette
swannodette / progress.md
Last active August 29, 2015 14:21 — forked from mfikes/progress.md

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);
platform :ios, '8.0'
pod 'Ambly', :git => 'https://github.com/swannodette/ambly', :branch => 'podspec', :commit => '095f529'
pod 'Ejecta', :git => 'https://github.com/swannodette/Ejecta', :branch => 'podspec', :commit => 'e8f3219b'
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]
(println "hello!")
(defui Artist
static IQuery
(query [cl _]
[:db/id :artist/name])
Object
(render [{:keys [props]}]
(dom/div nil (:artist/name props))))
(defui ArtistList
static IQuery
@swannodette
swannodette / bar.js
Created March 18, 2015 14:01
Closure CommonJS Transform
function woz(a, b) {
return wozwoz(a, b);
};
module.exports = {
woz: woz
};
(require 'cljs.closure)
(cljs.closure/build "src"
{:optimizations :advanced
:modules
{:app {:output-to "out/app.js"
:entries '#{hello-world.core}}}})
(defn lookup-contract [m allowed]
(reify
clojure.lang.ILookup
(valAt [coll k]
(.valAt coll k nil))
(valAt [coll k not-found]
(if (contains? allowed m)
(.valAt coll k not-found)
(throw (IllegalArgumentException.
(str k " violates lookup contract, allowed " allowed)))))))