Skip to content

Instantly share code, notes, and snippets.

View duhaime's full-sized avatar

Douglas Duhaime duhaime

View GitHub Profile
@duhaime
duhaime / README.md
Created October 25, 2017 13:04 — forked from Neilos/README.md
Bi-directional hierarchical sankey diagram

This is a demonstration of a bi-directional hierarchical sankey diagram produced in javascript, html and css using d3. (Refresh page to generate new random data)

Sankey diagrams represent flows between nodes by varying the thickness of the connecting links.

This diagram was based off of Mike Bostock's sankey diagram, but additionally incorporates bi-directionality into the flow and caters for hierarchical relationships between nodes to allow drill down into the data.

All javascript code to generate the diagram markup is contained in the app.js file, but the underlying calculations are performed using a custom plugin: bihisankey.js.

@duhaime
duhaime / web-servers.md
Created November 25, 2017 15:32 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@duhaime
duhaime / what-forces-layout.md
Created December 10, 2017 03:18 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@duhaime
duhaime / index.html
Created January 1, 2018 15:45 — forked from syntagmatic/index.html
Canvas Random Motion
<canvas id="canvas"></canvas>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var num = 20000;
var canvas = document.getElementById("canvas");
var width = canvas.width = 960;
var height = canvas.height = 500;
var ctx = canvas.getContext("2d");
@duhaime
duhaime / README.md
Created January 1, 2018 15:46 — forked from newby-jay/LICENSE
Vector field flow visualization
@duhaime
duhaime / .block
Created March 27, 2018 15:00 — forked from rveciana/.block
Path in a map, animated with scroll
scrolling: yes
@duhaime
duhaime / .block
Created March 27, 2018 15:03 — forked from summer4096/.block
Mapbox GL 3d data demo
license: MIT
@duhaime
duhaime / README.md
Created March 27, 2018 15:08 — forked from veltman/README.md
Duotoning

Using SVG filters to apply a duotone effect.

@duhaime
duhaime / index.html
Created March 27, 2018 15:09 — forked from veltman/index.html
Gradual pixelation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
</head>
<body>
<canvas width="960" height="500"></canvas>
<script>
var canvas = document.querySelector("canvas"),
@duhaime
duhaime / index.html
Last active April 5, 2018 19:18 — forked from wboykinm/index.html
Map with Georectified Video Asset
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Mapbox GL JS Examples</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.2.0/mapbox-gl.js'></script>
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }