Skip to content

Instantly share code, notes, and snippets.

Ashish Singh git-ashish

Block or report user

Report or block git-ashish

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
git-ashish / graph.json
Last active Aug 29, 2015 — forked from mbostock/.block
Force-Directed Tree Layout
View graph.json
"nodes": [
{"name": "d3"},
{"name": "d3.svg"},
{"name": "d3.svg.area"},
{"name": "d3.svg.line"},
{"name": "d3.scale"},
{"name": "d3.scale.linear"},
{"name": "d3.scale.ordinal"}
View elementsFromPoint.js
// returns a list of all elements under the cursor
function elementsFromPoint(x,y) {
var elements = [], previousPointerEvents = [], current, i, d;
// get all elements via elementFromPoint, and remove them from hit-testing in order
while ((current = document.elementFromPoint(x,y)) && elements.indexOf(current)===-1 && current != null) {
// push the element and its current style
nrabinowitz / fitProjection.js
Created Feb 7, 2012
D3 function for fitting a projection to geodata
View fitProjection.js
function fitProjection(projection, data, box, center) {
// get the bounding box for the data - might be more efficient approaches
var left = Infinity,
bottom = -Infinity,
right = -Infinity,
top = Infinity;
// reset projection
.translate([0, 0]);
aronwoost /
Created Jul 25, 2011
How to install LAMP on a EC2 Amazon AMI

Launch the instance and connect with ssh.

##Update the server

sudo yum update

##Install php and MySQL packages

rpgove / data.tsv
Last active May 5, 2019
Force-Directed Scatterplot
View data.tsv
sepalLength sepalWidth petalLength petalWidth species
5.1 3.5 1.4 0.2 setosa
4.9 3.0 1.4 0.2 setosa
4.7 3.2 1.3 0.2 setosa
4.6 3.1 1.5 0.2 setosa
5.0 3.6 1.4 0.2 setosa
5.4 3.9 1.7 0.4 setosa
4.6 3.4 1.4 0.3 setosa
5.0 3.4 1.5 0.2 setosa
4.4 2.9 1.4 0.2 setosa
mrcslws / .block
Last active May 7, 2019 — forked from mbostock/.block
Pan & Zoom Axes
View .block
license: gpl-3.0
mbostock / .block
Last active May 8, 2019
OMG Particles II
View .block
license: gpl-3.0
emeeks /
Last active Jun 6, 2019
Network Annotation with Collision Detection

Using collision detection with network visualization labels

This demonstrates how to use d3-annotation() with bboxCollide to procedurally place node labels. After using the nodes data to create a network visualization of the Les Miserables play, we filter the nodes to leave out the side characters and pass that array to d3-annotation. We then create a second forceSimulation, this time using the size of the notes as the property in our bounding box collision detection, to move the labels out of each others' way.

d3-annotation by Susie Lu.

mbostock / .block
Last active Jul 5, 2019
Line with Missing Data
View .block
license: gpl-3.0
roboshoes / touchmouse.js
Created Apr 13, 2012
This snippet maps mouse events and touch events onto one single event. This makes it easier in the code since you have to listen to only one event regardles whether it's desktop or mobile.
View touchmouse.js
(function() {
TouchMouseEvent = {
DOWN: "touchmousedown",
UP: "touchmouseup",
MOVE: "touchmousemove"
You can’t perform that action at this time.