Skip to content

Instantly share code, notes, and snippets.

View sgrove's full-sized avatar
💭
Infinigraph, and beyond!

Sean Grove sgrove

💭
Infinigraph, and beyond!
View GitHub Profile
@sgrove
sgrove / framebuffer.cljs
Created June 4, 2015 22:08
Framebuffer draw call working and not working
(defn draw-fn [gl driver programs]
(fn [state]
(let [{:keys [p mv
color-texture specular-texture
sphere
model
rotation]} (:scene state)
now (/ (.getTime (js/Date.)) 50)
rotation (- (utils/deg->rad now))
program (get programs :simple)
@sgrove
sgrove / uri_parser.cljs
Created June 2, 2015 03:01
General URI Query Param to ClojureScript datastructure function
;; Remember to (:import goog.Uri) in your ns declaration
;; Example input/output:
;; http://localhost:10555/?model=duck&manual-tick=false&collapse-all=true&capture-first-frame=true&skybox-name=sky1.png&age=30&money=300.30
;; => {:model "duck",
;; :tick-first-frame? false,
;; :manual-tick? false,
;; :collapse-all? true,
;; :capture-first-frame? true,
;; :skybox-name ["sky1" "png"],
;; :age 30,
{"accessors":{"accessor_1007":{"bufferView":"bufferView_1595","byteOffset":8048,"byteStride":0,"componentType":5123,"count":30,"type":"SCALAR"},"accessor_1009":{"bufferView":"bufferView_1596","byteOffset":45256,"byteStride":12,"componentType":5126,"count":18,"max":[0.375046,0.177852,0.72784],"min":[0.324467,0.0408841,0.0562498],"type":"VEC3"},"accessor_1011":{"bufferView":"bufferView_1596","byteOffset":45472,"byteStride":12,"componentType":5126,"count":18,"max":[1,0.980105,0.17604],"min":[-1,-0.980105,-0.17604],"type":"VEC3"},"accessor_1013":{"bufferView":"bufferView_1596","byteOffset":45688,"byteStride":8,"componentType":5126,"count":18,"max":[-21.3007,2.61097],"min":[-24.0781,-1.39691],"type":"VEC2"},"accessor_1034":{"bufferView":"bufferView_1595","byteOffset":8516,"byteStride":0,"componentType":5123,"count":24,"type":"SCALAR"},"accessor_1036":{"bufferView":"bufferView_1596","byteOffset":47656,"byteStride":12,"componentType":5126,"count":16,"max":[0.311125,0.18009,0.725909],"min":[0.26035,0.0464297,0.056249
@sgrove
sgrove / learn_gamma_09.cljs
Last active August 29, 2015 14:21
Compare "Learn WebGL 09" with "Learn Gamma 09"
(ns gampg.learn-gamma.lesson-09
(:require [clojure.string :as s]
[gamma.api :as g]
[gamma.program :as p]
[gamma.tools :as gt]
[gamma-driver.drivers.basic :as driver]
[gamma-driver.protocols :as dp]
[goog.webgl :as ggl]
[thi.ng.geom.core :as geom]
[thi.ng.geom.core.matrix :as mat :refer [M44]]
@sgrove
sgrove / gamma_lesson_07.cljs
Last active August 29, 2015 14:21
Compare "Learn WebGL 07" with "Learn Gamma 07"
;; NB: Missing the html controls to edit the parameters,
;; will add them in later for a fair comparison
(ns gampg.learn-gamma.lesson-07
(:require [clojure.string :as s]
[gamma.api :as g]
[gamma.program :as p]
[gamma.tools :as gt]
[gamma-driver.drivers.basic :as driver]
[gamma-driver.protocols :as dp]
[goog.webgl :as ggl]
@sgrove
sgrove / learn_gamma.cljs
Last active August 29, 2015 14:21
Compare "Learn WebGL Lesson 1" with "Learn Gamma Lesson 1"
;; 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]
@sgrove
sgrove / lesson_06.cljs
Created May 14, 2015 07:27
Learn Gamm 06: Texture filters
(ns ^:figwheel-load gampg.learn-gamma.lesson-06
(:require [clojure.string :as s]
[gamma.api :as g]
[gamma.program :as p]
[gamma.tools :as gt]
[gamma-driver.drivers.basic :as driver]
[gamma-driver.protocols :as dp]
[goog.webgl :as ggl]
[thi.ng.geom.core :as geom]
[thi.ng.geom.core.matrix :as mat :refer [M44]]

OCamlion

OCamlion (pronounced oh-camelion) is a static-site generator, useful for blogs and documentation. It relies on git as the underlying state/history mechanism for all source material.

Workflow

OCamlion can be used from either the command line, as a scriptable tool, or inside the browser itself.

Browser workflow

At a high-level, we use Irmin to pull a blog's git repository into the browser and store the raw git history in IndexedDB. We then render both your site and some administration tools in a special editing mode. You can edit and see changes in real-time, save changes locally, and push them to the remote repository when you're finished.

@sgrove
sgrove / Makefile
Created March 20, 2015 18:14
manual reloadlib target
.PHONY: all clean tower test
DIRTY_FLAG=$(shell git diff-index --quiet HEAD || echo "dirty")
ifeq ($(DIRTY_FLAG),dirty)
DIRTY=true
else
DIRTY=false
endif
all: tower
@sgrove
sgrove / modori.js
Created January 7, 2015 01:38
Modori - Idiomatic Mori
/* Example usage
npm i mori
node modori.js
Most credit for the implementation basis goes to https://github.com/chenglou
*/
var mori = require('mori');
function MoriObj(coll) {