Skip to content

Instantly share code, notes, and snippets.

View Dudemullet's full-sized avatar
🤓
//

Pipe Gutierrez Dudemullet

🤓
//
View GitHub Profile
@Dudemullet
Dudemullet / index.html
Created April 29, 2012 07:19
basic d3 example
<html>
<head>
<title>Simple D3 demo</title>
</head>
<body>
<div id="myDiv">
</div>
<script type="text/javascript" src="https://raw.github.com/mbostock/d3/master/d3.v2.js"></script>
<script type="text/javascript">
@Dudemullet
Dudemullet / index.html
Created May 11, 2014 21:57
Server simple video stream
<!doctype html>
<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
</head>

d3.legend

d3.legend is a quick hack to add a legend to a d3 chart. Simply add a g and .call(d3.legend). Any elements that have a title set in the "data-legend" attribute will be included when d3.legend is called. Each title will appear only once (even when multiple items define the same data-legend) as the process uses a set based on a existing names, not an array of all items.

Color

By default the color in the legend will try to match the fill attribute or the stroke attribute of the relevant items. Color can be explicitly defined by attribute "data-legend-color"

Order

The order of items in the legend will be sorted using the top of the bounding box for each included item. The order can be explicitly defined by attribute "data-legend-pos"

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@Dudemullet
Dudemullet / .gitconfig
Last active August 29, 2015 14:05
Open any one of your remote git repos in a browser via cli. Great after pushing changes and wanting to create a pull request. Append this to your .gitconfig file
[alias]
web = "!f(){ url=$(git config --get remote.$1.url); git web--browse $url;}; f"
# useage
# git web origin - open your remote origin repo in the browser
@Dudemullet
Dudemullet / makersquare.md
Created August 11, 2014 23:36
useful links for the makersquare meetup
@Dudemullet
Dudemullet / README.md
Last active August 29, 2015 14:23 — forked from diegovalle/README.md

How to create the topojson map:

curl -o estados.zip http://mapserver.inegi.org.mx/MGN/mge2010v5_0.zip
curl -o  municipios.zip http://mapserver.inegi.org.mx/MGN/mgm2010v5_0.zip
unzip estados.zip 
unzip municipios.zip
ogr2ogr states.shp Entidades_2010_5.shp -t_srs "+proj=longlat +ellps=WGS84 +no_defs +towgs84=0,0,0"
ogr2ogr municipalities.shp Municipios_2010_5.shp -t_srs "+proj=longlat +ellps=WGS84 +no_defs +towgs84=0,0,0"
topojson -o mx_tj.json -s 1e-7 -q 1e5 states.shp municipalities.shp -p state_code=+CVE_ENT,state_name=NOM_ENT,mun_code=+CVE_MUN,mun_name=NOM_MUN
@Dudemullet
Dudemullet / data.json
Last active August 29, 2015 14:23
Sensores Pluviales en Cuenca de Mexico
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Dudemullet
Dudemullet / data.json
Created June 16, 2015 04:59
Simulacion de municipios Mexicanos
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Dudemullet
Dudemullet / README.md
Created June 18, 2015 16:49
Peligro por inundacion por municipios

Este mapa muestra el peligro de inundacion por municipio de Mexico. Los datos son brindado por la CENAPRED y los puedes encontrar en MXAbierto.