This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from https://github.com/dbertella/cheap-flights/blob/master/proxy/server.js | |
var http = require('http'), | |
httpProxy = require('http-proxy'); | |
var port = 3000; | |
var proxy = httpProxy.createProxyServer(); | |
http.createServer(function(req, res) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "test coverage example", | |
... | |
"scripts": { | |
"test": "NODE_ENV=test mocha --colors build/spec --timeout 5000", | |
"coverage": "NODE_ENV=test ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -R spec" | |
}, | |
"dependencies": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<svg width="960" height="500"></svg> | |
<div id="gui"></div> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<script> | |
var svg = d3.select("svg"), | |
width = +svg.attr("width"), | |
height = +svg.attr("height"), | |
transform = d3.zoomIdentity; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// thanks to https://gitter.im/mikolalysenko/regl | |
import createRegl from 'regl' | |
const mat4 = require('gl-mat4') | |
const cubePosition = [ | |
[-0.5, +0.5, +0.5], [+0.5, +0.5, +0.5], [+0.5, -0.5, +0.5], [-0.5, -0.5, +0.5], // positive z face. | |
[+0.5, +0.5, +0.5], [+0.5, +0.5, -0.5], [+0.5, -0.5, -0.5], [+0.5, -0.5, +0.5], // positive x face | |
[+0.5, +0.5, -0.5], [-0.5, +0.5, -0.5], [-0.5, -0.5, -0.5], [+0.5, -0.5, -0.5], // negative z face |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// inspired by toxiclibs | |
// https://bitbucket.org/postspectacular/toxiclibs/src/44d9932dbc9f9c69a170643e2d459f449562b750/src.core/toxi/geom/mesh/TriangleMesh.java?at=default&fileviewer=file-view-default#TriangleMesh.java-703 | |
const vec3 = require('gl-vec3') | |
const mat3 = require('gl-mat3') | |
const mat4 = require('gl-mat4') | |
const quat = require('gl-quat') | |
function transform(matrix, v) { | |
const temp = mat3.create() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// quaternion code from https://github.com/stackgl/gl-quat | |
// rotation from https://twistedpairdevelopment.wordpress.com/2013/02/11/rotating-a-vector-by-a-quaternion-in-glsl/ | |
precision mediump float; | |
uniform mat4 projection, view; | |
uniform vec3 translate; | |
uniform vec3 scale; | |
attribute vec3 normal; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import createRegl from 'regl' | |
import createCamera from 'regl-camera' | |
import bunny from 'bunny' | |
import normals from 'angle-normals' | |
const regl = createRegl() | |
const camera = createCamera(regl, { | |
minDistance: 0.01, | |
distance: 20, | |
maxDistance: 30, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ES6 port of famous mbostock's word wrap https://bl.ocks.org/mbostock/7555321 | |
export function wrap(_text, width, lineHeightEm = 1.1) { | |
_text.each(function () { | |
const text = select(this) | |
const words = text.text().split(/\s+/).reverse() | |
const y = text.attr('y') | |
const dy = parseFloat(text.attr('dy')) || 0 | |
let tspan = text.text(null).append('tspan').attr('x', 0).attr('y', y).attr('dy', dy + 'em') | |
let line = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const emptyTextureDimension = { | |
width: 512, | |
height: 512, | |
channels: 3, | |
} | |
function loadImageIntoTexture(url, texture) { | |
const image = new Image() | |
image.crossOrigin = 'anonymous' | |
image.src = url |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
precision mediump float; | |
uniform sampler2D satellite0; | |
uniform sampler2D satellite1; | |
uniform sampler2D satellite2; | |
uniform sampler2D satellite3; | |
uniform sampler2D elevation; | |
varying vec2 vUv; |