Skip to content

Instantly share code, notes, and snippets.

View saleiva's full-sized avatar
🤓

Sergio Álvarez Leiva saleiva

🤓
View GitHub Profile
@mbostock
mbostock / .block
Last active February 8, 2016 23:17
Heatmap
license: gpl-3.0
@andrewxhill
andrewxhill / size_order.sql
Created October 11, 2012 22:17
Order polygons by size/height
WITH RECURSIVE dims AS (SELECT 2*sqrt(sum(ST_Area(the_geom))) as d, sqrt(sum(ST_Area(the_geom)))/20 as w, count(*) as rows FROM osm_export_polygon WHERE the_geom IS NOT NULL),
geoms AS (SELECT the_geom, ST_YMax(the_geom)-ST_YMin(the_geom) as height FROM osm_export_polygon WHERE the_geom IS NOT NULL ORDER BY ST_YMax(the_geom)-ST_YMin(the_geom) DESC),
geomval AS (SELECT the_geom, row_number() OVER (ORDER BY height DESC) as id from geoms),
positions(the_geom,x_offset,y_offset,new_row,row_offset) AS (
(SELECT the_geom, 0.0::float, 0.0::float, FALSE, 2 from geomval limit 1)
UNION ALL
(
SELECT
(SELECT the_geom FROM geomval WHERE id = p.row_offset),
CASE WHEN
@wsvekla
wsvekla / README.md
Last active December 10, 2015 19:58
Datos de Guatemala con D3 y CartoDB

Estos límites municipales de Guatemala se extraen de un archivo GeoJSON guardado en una tabla en CartoDB. Shapefile original fue recogido de GADM, la base de datos de global áreas administrativas.

@subtleGradient
subtleGradient / delete twitter DMs.js
Created July 8, 2013 02:07
Delete Twitter Direct Messages. Go here: https://twitter.com/messages?since_id=0 Then paste this stuff into your Chrome inspector console
// delete console.log
querySelectorAttempt._timerIDs = []
function querySelectorAttempt(selectors, callback, _attempts){
if (!Array.isArray(selectors)) selectors = selectors.toString().split(/\s*,\s*/)
console.log('querySelectorAttempt', selectors, _attempts)
if (_attempts == null) _attempts = 20;
var elements
selectors.forEach(function(selector){
if (elements && elements.length > 0) return;
elements = document.querySelectorAll(selector);
@andy-esch
andy-esch / README.md
Last active May 18, 2016 19:51
baltimore economic data through the data observatory

Baltimore Data through the Data Observatory

See map

Step 1

Create an empty table, rename it to baltimore_economic_data

Get Boundaries, filter by Baltimore's FIPS (24510)