Skip to content

Instantly share code, notes, and snippets.

@nbremer
nbremer / .block
Last active February 14, 2017 06:39
Brushable Horizontal Bar Chart - I
height: 540
@larsenmtl
larsenmtl / .block
Created May 21, 2016 16:57
Getting hover-interaction and brushing to co-exist
license: cc-by-sa-4.0
@1wheel
1wheel / geometry.js
Last active November 8, 2022 13:46
line-intersection
//creates new point
function P(x, y, color){
var rv
if (x.map){
rv = {x: x[0], y: x[1], color: 'black'}
} else{
rv = {x: x, y: y, color: color || 'black'}
}
rv.toString = function(){ return rv.x + ',' + rv.y }
rv.type = 'point'
@noelvo
noelvo / download-multiple-files.js
Created December 6, 2015 23:22
Download multiple files then compress to one zip file using JSZip & JSZip-utils
var zip = new JSZip();
var count = 0;
var zipFilename = "zipFilename.zip";
var urls = [
'http://image-url-1',
'http://image-url-2',
'http://image-url-3'
];
urls.forEach(function(url){
@d3noob
d3noob / .block
Last active May 18, 2021 11:58
Favorite tooltip (complex version)
license: mit
@jebeck
jebeck / CDT all about D3 time scales.png
Last active June 2, 2022 02:21
all about D3 time scales
CDT all about D3 time scales.png
@mbostock
mbostock / .block
Last active April 2, 2018 18:47
Drag Slider
license: gpl-3.0
@mbostock
mbostock / .block
Last active April 11, 2024 18:53
Brush Snapping
license: gpl-3.0
redirect: https://observablehq.com/@d3/brush-snapping-transitions
@aras-p
aras-p / preprocessor_fun.h
Last active April 12, 2024 17:24
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@lgersman
lgersman / README.md
Last active October 19, 2022 12:15
improved version of my d3.js selection frame example (https://gist.github.com/lgersman/5310854) supporting draggable/selectable nodes
  • Click into the drawing area to start the selection frame
  • move the mouse to resize the selection frame
  • Release the mouse button to resize the selection frame

new features :

  • circles are draggable
  • circles can be selected (multiple selections possible by pressing CTRL while clicking a circle)
  • the selection frame selects all circles within the frame (by pressing CTRL the selected circles will be appended to current selection)
  • multiple selected circles will be dragged simultaneous