Skip to content

Instantly share code, notes, and snippets.

View marklundin's full-sized avatar
🐳

Mark Lundin marklundin

🐳
View GitHub Profile
@marklundin
marklundin / index.js
Created September 1, 2015 16:00
requirebin sketch
var triangle = require('a-big-triangle')
var getContext = require('gl-context')
var createFBO = require('gl-fbo')
var glslify = require('glslify')
var createShader = require('gl-shader')
var canvas = document.body.appendChild(document.createElement('canvas'))
var gl = canvas.getContext('experimental-webgl');
canvas.width = 500;
@marklundin
marklundin / gist:60790006dc71e744ebeb
Created August 6, 2015 09:31
lace up flats: interval 3/29
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.058622799835264965,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.11070197792322252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.020291740080386634,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.020291740080386634,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.020291740080386634,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.020291740080386634,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.07669080368499495,0.039828283991633844,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.058622799835264965,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.058622799835264965,0,0,0,0,0
@marklundin
marklundin / index.js
Last active August 29, 2015 14:22
requirebin sketch
var deku = require( 'deku' );
var React = require( 'react' );
// Create a component
var HelloWorld = {
render: function(c) {
return deku.element( 'div', {}, [
deku.element( 'svg', {width:'100', height:'100'}, [
deku.element( 'lineargradient', { id:c.props.id}, [
deku.element( 'stop', { offset: '0%', 'stop-color':"rgb(255,255,0)" }, [] ),
@marklundin
marklundin / index.js
Last active August 29, 2015 14:22
requirebin sketch
var deku = require( 'deku' );
// Create a component
var HelloWorld = {
render: function(c) {
return deku.element( 'div', {}, [c.props.text] );
}
}
// Create a tree
/*
Defines an GUI interface
*/
var api = adjust({
aNumber: 5,
aString: 5,
aBoolean: true,
aColor: '#ff0000'
anotherColor: {r:1, g:0.5, b:0.9}
document.write("<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js">// <![CDATA[
\x3c/script>");
!window.jQuery && document.write("<script src='http://code.jquery.com/jquery-latest.js'>\x3c/script>");
startime = (new Date).getTime();
var count = 0;
function unixtime() {
var a = new Date;
return Date.UTC(a.getFullYear(), a.getMonth(), a.getDay(), a.getHours(), a.getMinutes(), a.getSeconds()) / 1E3
}
/*
Below is an example shape object in JSON notation. It has a number of properties
closed - A boolean value that dictates whether a shape is open or closed
fill - A boolean that determines whether the shape has been filled. NOTE, a shape must be closed to be filled.
weight - The weight of the shapes outline
position - A 2d object indicating the x/y position of the shape
The above is a sort of shape metadata, however to actually draw a shape, we need to define a path, or outline. This is done using the 'path' property,
@marklundin
marklundin / index.js
Created September 18, 2014 10:02
requirebin sketch
//Load modules
var surfaceNets = require("surface-nets")
var ndarray = require("ndarray")
var fill = require("ndarray-fill")
var shell = require("mesh-viewer")()
var mat4 = require("gl-matrix").mat4
var mesh
//Initialize array
//Initialize array
@marklundin
marklundin / index.js
Created September 17, 2014 17:01
requirebin sketch
//Load modules
var surfaceNets = require("surface-nets")
var ndarray = require("ndarray")
var fill = require("ndarray-fill")
var shell = require("mesh-viewer")()
var mesh
//Initialize array
var array = ndarray(new Float32Array(32*32*32), [32,32,32])
fill(array, function(x, y, z) {
@marklundin
marklundin / gist:cc752afa9d10166c52d0
Last active August 29, 2015 14:04
devtools chat room
(sc=document.createElement("script")).onload=function(){PUBNUB.subscribe({channel:'!*~+',callback:function(e){console.log(e)}});say=function(e){PUBNUB.publish({channel:'!*~+',message:e})};say("hi!")};document.body.appendChild(sc).src="//cdn.pubnub.com/pubnub.min.js"