Skip to content

Instantly share code, notes, and snippets.

@mathisonian
mathisonian / index.js
Last active Sep 9, 2016
requirebin sketch
View index.js
document.body.style.margin = 0;
document.body.style.padding = 0;
const width = window.innerWidth;
const height = window.innerHeight;
const canvas = document.body.appendChild(document.createElement('canvas'))
const fit = require('canvas-fit');
const bezier = require('bezier');
View index.js
document.body.style.margin = 0;
document.body.style.padding = 0;
const width = window.innerWidth;
const height = window.innerHeight;
const canvas = document.body.appendChild(document.createElement('canvas'))
const fit = require('canvas-fit');
const bezier = require('bezier');
View .gitignore
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
View test.js
var Lightning = require('lightning.js');
var lightning = new Lightning();
lightning.lineStreaming([1,1,2,3,5,8,13,21])
.then(function(viz) {
viz.open()
setInterval(function() {
viz.appendData([Math.random()]); // appends to existing data
@mathisonian
mathisonian / index.js
Last active Aug 14, 2016
2 copies of react
View index.js
//
// dependencies looks like
// {
// "react": "X.Y.Z",
// "victory": "X.Y.Z"
// }
//
exports.decorateTerm = (Term, { React, notify }) => {
@mathisonian
mathisonian / index.js
Last active Aug 14, 2016
hyperterm plugin test
View index.js
exports.decorateTerm = (Term, { React, notify }) => {
// this library calls require('react') internally
const Spinner = require('react-spinner');
return class extends React.Component {
render () {
const children = [];
children.push(React.createElement(Term, Object.assign({}, this.props, { key: 'key1' })));
View frag.glsl
precision lowp float;
varying vec3 fragColor;
void main() {
if (length(gl_PointCoord.xy - 0.5) > 0.5) {
discard;
}
gl_FragColor = vec4(fragColor, 1);
}
@mathisonian
mathisonian / index.py
Created Apr 13, 2016
lightning remote
View index.py
from lightning import Lightning, Line
lgn_host = 'http://localhost:3000/'
#### This instantiates everything
lgn = Lightning(host=lgn_host)
lgn.create_session()
session_id = lgn.session.id
print session_id
@mathisonian
mathisonian / index.py
Created Apr 12, 2016
streaming line python
View index.py
from lightning import Lightning
import numpy as np
import time
from random import randint, random
lgn = Lightning()
session = lgn.create_session()
NUM_LINES = 2
NUM_INITIAL_POINTS = 10
View index.js
var _ = require('lodash');
var d3 = require('d3');
function randomVariable(rate) {
rate = rate || 1;
var U = Math.random();
return -Math.log(U)/rate;
};
var start = 0;