Skip to content

Instantly share code, notes, and snippets.

{"contents":{"launch":{"version":"0.2.0","configurations":[{"type":"node","request":"launch","name":"Mocha All","program":"${workspaceFolder}/node_modules/mocha/bin/_mocha","args":["--timeout","999999","--colors","${workspaceFolder}/test"],"console":"integratedTerminal","internalConsoleOptions":"neverOpen"},{"type":"node","request":"launch","name":"Mocha Current File","program":"${workspaceFolder}/node_modules/mocha/bin/_mocha","args":["--timeout","999999","--colors","${file}"],"console":"integratedTerminal","internalConsoleOptions":"neverOpen"}]}},"overrides":[],"keys":["launch.version","launch.configurations"]}
@ningunaparte
ningunaparte / gist:08499682680b49d20745ca5970e91d8e
Created December 15, 2016 11:30
Devuelve el área de un polígono en javascript
// DEVUELVE EL AREA DE TERMINADO POLIGONO
// http://www.mathopenref.com/coordpolygonarea2.html
function polygonArea(X, Y, numPoints) {
area = 0; // Accumulates area in the loop
j = numPoints - 1; // The last vertex is the 'previous' one to the first
for (i = 0; i < numPoints; i++) {
area = area + (X[j] + X[i]) * (Y[j] - Y[i]);
@ningunaparte
ningunaparte / gist:bdb0e6be3b7f675d66b7f7320c0c8682
Created October 4, 2016 08:38
Formatting numbers with d3
//BASED ON Michael Stanaland’s Block 6106487
//http://bl.ocks.org/mstanaland/6106487
Starting number: 1500
d3.format(",") : 1,500
d3.format(".1f") : 1500.0
@ningunaparte
ningunaparte / README.md
Last active August 29, 2015 14:25 — forked from mbostock/.block
Bubble Chart

Bubble charts encode data in the area of circles. Although less perceptually-accurate than bar charts, they can pack hundreds of values into a small space. Implementation based on work by Jeff Heer. Data shows the Flare class hierarchy, also courtesy Jeff Heer.

@ningunaparte
ningunaparte / onComplete endAll
Last active August 29, 2015 14:23
D3 transition "onComplete"
//Cuando finalizan todas las animaciones ejecuta el callback
function endAll(transition, callback) {
var n = 0;
transition.each(function() { ++n; })
.each('end', function() {
if (!--n) callback.apply(this, arguments);
});
}
@ningunaparte
ningunaparte / d3.locale.ES.js
Created April 22, 2015 14:26
How to format D3.js dates and numbers to spanish - Localizar al español fechas y números
// https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.js
// SAMPLE https://jsfiddle.net/ningunaparte/9gm68vmn/
var nowDate = new Date();
// ES LOCATION
// d3.locale Spanish Spain / Español
// https://github.com/mbostock/d3/wiki/Localization
var es_ES = {