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
@aronwoost
aronwoost / README.md
Created Jul 25, 2011
How to install LAMP on a EC2 Amazon AMI
View README.md

Launch the instance and connect with ssh.

##Update the server

sudo yum update

##Install php and MySQL packages

View csv-to-json.php
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
header('Content-type: application/json');
// Set your CSV feed
@mbostock
mbostock / .block
Last active Sep 10, 2019
DOM-to-Canvas using D3
View .block
license: gpl-3.0
@nrabinowitz
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
projection
.scale(1)
.translate([0, 0]);
@roboshoes
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() {
/* == GLOBAL DECLERATIONS == */
TouchMouseEvent = {
DOWN: "touchmousedown",
UP: "touchmouseup",
MOVE: "touchmousemove"
}
/* == EVENT LISTENERS == */
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
@mbostock
mbostock / .block
Last active May 8, 2019
OMG Particles II
View .block
license: gpl-3.0
View README.md

A map of the sky that uses an azimuthal equidistant projection with star data. Longitudes and latitudes for the geo projection are obtained from declination and right ascension respectively (longitude is also inverted, because, unlike the earth globe, the celestial sphere is seen from the inside).

The boreal (northern) sky is shown at left, while the austral (southern) at right. Because right ascension is given in hours, both maps are divided in 24 slices. A circle is shown every 10 degrees of declination.

Star size indicates magnitude. Bigger circles depict brighter stars.

@rpgove
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
@git-ashish
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"}
],
You can’t perform that action at this time.