Skip to content

Instantly share code, notes, and snippets.

View LuisSevillano's full-sized avatar

Luis Sevillano LuisSevillano

View GitHub Profile
@LuisSevillano
LuisSevillano / get_leaflet_layers_polygons.js
Created January 19, 2024 10:54
Gell all polygons from a rendered Leaflet map
// chrome snippet
var layersMarkers = [];
var layersPolygons = [];
var layers = []
var geojson = {
"type": "FeatureCollection",
"features": []
}
var output = {
"type": "FeatureCollection",
@LuisSevillano
LuisSevillano / index.html
Last active November 9, 2023 14:23
Population around the biggest cities of Spain
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
html {
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
@LuisSevillano
LuisSevillano / README.md
Last active January 23, 2023 17:17
Tracking Irma hurricane with Leaflet

Tracking the path of hurricanes Irma and Jose. Source: European Center for Medium-Range Weather Forecasts, National Weather Service.
Tiles from MODIS Terra.

@LuisSevillano
LuisSevillano / README.md
Created October 7, 2017 23:07
Center and Scale your map
@LuisSevillano
LuisSevillano / .block
Last active January 25, 2021 09:41
RBush+canvas+svg
border: none
height: 600
@LuisSevillano
LuisSevillano / scale.js
Created January 4, 2021 19:06
Invert d3 scaleBand
// https://github.com/d3/d3-scale/blob/11777dac7d4b0b3e229d658aee3257ea67bd5ffa/src/band.js#L32
x.invert = function(_) {
const scale = this;
const domain = scale.domain;
const paddingOuter = scale.paddingOuter();
const paddingInner = scale.paddingInner();
const step = scale.step();
const range = scale.range();
var domainIndex,
@LuisSevillano
LuisSevillano / node.md
Last active October 30, 2019 15:24
Regex to replace commas to points in gedit

How to use a regex to replace commas with points using gedit: Having a csv like following:

c,m,p2019,p2016,p2015,p2011
w,x,"75.74","77.50","74.98","78.14"
g,f,"76.80","71.99","71.97","77.75"
i,b,"69.41","64.28","62.95","69.20"
b,h,"80.00","77.41","74.58","80.13"
@LuisSevillano
LuisSevillano / .block
Last active October 19, 2019 11:15
New composite border in es-atlas
border:none
height:696
license:MIT
@LuisSevillano
LuisSevillano / script.R
Created September 30, 2019 08:26
Extract data from ggplot plot
plot <- ggplot(data = pf, aes(x = age, y = df)) +
geom_point(alpha = 1/100,
position = position_jitter(h = 0),
color = "darkred")
ggplot(data = layer_data(plot, 1), aes(x = x, y = y)) +
geom_point(alpha = 1/20)
@LuisSevillano
LuisSevillano / .block
Last active September 13, 2019 09:47
Path stroke with moveToFront
border: none
height: 600