Skip to content

Instantly share code, notes, and snippets.

View maggiben's full-sized avatar

Benjamin maggiben

  • Frávega
  • Argentina
View GitHub Profile
@jkutianski
jkutianski / README.md
Last active August 15, 2019 21:38
Proyección Gauss Kruger Argentina en D3.js

Para la Argentina la proyección oficial es la Gauss-Kruger, y esta difiere bastante de la proyección Mercator que es normalmente utilizada en mapas digitales. Si queremos desplegar el territorio argentino de manera de lograr una representación armoniosa que conserve las formas y áreas, lo recomendable es usa Gauss-Kruger.

Transverse Mercator vs Mercator

En D3.js no esta soportada esta proyeccion pero se puede optar por la proyección Mercator transversa d3.geo.transverseMercator() que es la base para la definición de la referencia cartográfica Gauss-Kruger. Esta proyección está definida dentro del plugin d3.geo.projection.js por lo que deberá ser cargado junto con d3.js.

Para poder calcular los parámetros necesarios para aplicar esta proyección es necesario calcular el centro geográfico de la Argentina continental, que está comprendida entre lo

@pjsvis
pjsvis / gist:6210002
Last active November 13, 2020 00:56
Angular directive for jQuery sparkline
// Requires jQuery from http://jquery.com/
// and jQuerySparklines from http://omnipotent.net/jquery.sparkline
// AngularJS directives for jquery sparkline
angular.module('sparkline', []);
angular.module('sparkline')
.directive('jqSparkline', [function () {
'use strict';
return {
@shovon
shovon / README.md
Last active April 18, 2019 08:37
An install script for LLVM and Clang v3.2.

Installing LLVM and Clang v3.2 on OS X

I'm assuming you need this version for Emscripten.

Don't worry, this script will not override your current installation of LLVM and Clang.

Be sure that you have:

  • read this README file
  • read this README file
@LinuxPanda
LinuxPanda / Youtube_Regex_Grab_Video-Playlist_ID_With_Time.php
Last active March 10, 2022 16:10
Best regex pattern to get youtube video/playlist id with/without time from any youtube link and generate embed code. This regex works with 1) youtube & youtu.be 2) http/https 3) with/without www.
<?php
/*
* @gist Regex to get youtube video/playlist id with/without time & generate embed code
* @license UNLICENSE (http://unlicense.org)
*/
$youtube_url = array(
"https://youtu.be/yVpbFMhOAwE",
"https://www.youtube.com/embed/yVpbFMhOAwE",
@mbostock
mbostock / .block
Last active December 20, 2024 23:57
Solar Terminator
license: gpl-3.0
redirect: https://observablehq.com/@mbostock/solar-terminator
@r3b
r3b / divSwirl.js
Last active July 29, 2019 20:46
create a spinning vortex of randomly-colored divs on any page. handy if you need to create entropy or stress on a page. Now with stars!
(function(){
var db = document.body, //shortcut to document.body
r = 100, //initial radius of the circle
x = (db.clientWidth - r) / 2, //horizontal center
y = (window.pageYOffset || (db.parentNode || db).scrollTop) + ((window.innerHeight+r)/2), //offset from page top
o = 0.0, //angle offset
w = 0, //width of square
dl = 150, //number of divs
ai=Math.PI / dl, //pie slice width
divs=Array.prototype.map.call(new Int8Array(dl),function(){ //div array
@jbt
jbt / gist:3150819
Created July 20, 2012 13:47
If you can tell me what these two functions are for, you win a prize
t.prototype.REDACTED = function(a, b, j, c, g) {
for(var r = this.REDACTED2(0), t = Math.tan(r), C = g % 86400 / 86400 * Math.PI * 2, g = [], n = 0;n <= c + 1;n = n + 1) {
g[n] = Math.atan(Math.cos(2 * Math.PI * (j + n / c) / a + C) / t) / Math.PI * c * a / 2 - (b - a / 4) * c;
}
b = Math.max.apply(Math, g);
j = Math.min.apply(Math, g);
a = "";
if(g[0] > 0 && g[0] < c) {
a = "M0," + g[0];
if(b >= c) {
@wbzyl
wbzyl / README.md
Created July 17, 2012 20:42
Glow Filter

SVG Essentials – Filters

This is a recreation (for the purpose of tinkering with an implementation in d3.js) of the example from the book SVG Essentials by J. David Eisenberg.

The <feColorMatrix> element allows to change color values in a following way.

@nathanhammond
nathanhammond / Emscripten OS X.md
Created March 4, 2012 21:48
How to get Emscripten running on OS X.

Running emscripten on OS X

There are a number of additional dependencies required for getting things installed on OS X. Starting with a blank slate OS X machine, this is the process it takes:

# Install Xcode Command Line Tools

# Install Homebrew
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
@RedBeard0531
RedBeard0531 / functions.js
Created February 22, 2012 20:13
Min, Max, Sum, Count, Avg, and Std deviation using MongoDB MapReduce
// derived from http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm
function map() {
emit(1, // Or put a GROUP BY key here
{sum: this.value, // the field you want stats for
min: this.value,
max: this.value,
count:1,
diff: 0, // M2,n: sum((val-mean)^2)
});