Skip to content

Instantly share code, notes, and snippets.

View adriennn's full-sized avatar

Adrien Vetterli adriennn

View GitHub Profile
@adriennn
adriennn / README.md
Created November 2, 2018 06:26 — forked from emoruzzi/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.

This version addresses the issue with double clicking. Demo: http://bl.ocks.org/emoruzzi/6f8140c4d903e64ae35dce0c971e488f

@adriennn
adriennn / chrono.js
Last active October 23, 2017 13:25
Timer for nodejs processes
/*
* Timer to measure timing of stuff in nodejs
*/
class Chrono {
Start() {
this.start = new Date().getTime()
}
@adriennn
adriennn / nginx-cors.conf
Last active March 27, 2017 13:45 — forked from himyouten/nginx-cors.conf
nginx configuration for CORS (Cross-Origin Resource Sharing), with an origin whitelist, and HTTP Basic Access authentication allowed
# A CORS (Cross-Origin Resouce Sharing) config for nginx
# see details at https://gist.github.com/himyouten/df57b21958fba9c75ea7
if ($http_origin ~* (https?://.*\.garbagepla\.net(:[0-9]+)?)) {
rewrite ^ /__cors__/$request_method$uri last;
}
location /__cors__/GET/ {
add_header 'Access-Control-Allow-Origin' "$http_origin";
add_header 'Access-Control-Allow-Credentials' 'true';
@adriennn
adriennn / leaflet-css-divicon.txt
Created September 18, 2015 08:11
Create a lightweight L.divIcon for Leaflet using css and icon fonts
// modified from http://codepen.io/gisminister/pen/Hdorv
// Create a marker
var myMarker = L.divIcon({
className: 'map-marker marker-color-gray a-class',
iconSize: [28,28],
html:'<i class="fa fa-fw fa-2x fa-question"></i>' // FontAwesome.io
});
// Style with css