Skip to content

Instantly share code, notes, and snippets.

View LuisSevillano's full-sized avatar

Luis Sevillano LuisSevillano

View GitHub Profile
@LuisSevillano
LuisSevillano / .block
Last active September 13, 2019 09:24
d3-composite-projections test
border:none
height:700
@LuisSevillano
LuisSevillano / .block
Created December 4, 2017 18:41
From Hong Kong to Brussels
border: none
height: 960
@LuisSevillano
LuisSevillano / index.html
Last active September 13, 2019 09:21
mouse-over event on line path
<html>
<head>
<title></title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js" charset="utf-8"></script>
<style type="text/css">
body {
font: 10px sans-serif;
}
.randomize {
@LuisSevillano
LuisSevillano / .block
Created October 4, 2016 03:32
Hurricane Matthew
license: mit
border: none
height: 600
@LuisSevillano
LuisSevillano / .block
Last active September 13, 2019 09:18
Tree Fractal with SVG
license: mit
border: no
height: 500
@LuisSevillano
LuisSevillano / README.md
Last active September 13, 2019 09:14
textPath along path

Funny use of textPath svg tag.
I was thinking about to use it in a feature about global warming at the end of 2016. The textPath will follow the cursor along the path when the mouseover event is thrown.
Its a cool effect when you have a smooth line but not when the data is too much variable or irregular. So use of the feature doesnt have any sense. The following pictures show how textPath works:

firstImagefirstImage

"The small dot above shows the point at which the glyph is attached to the path. The box around the glyph shows the glyph is rotated such that its horizontal axis is parallel to the tangent of the curve at the point at which the glyph is attached to the path. The box also shows the glyph's charwidth (i.e., the amount which the current text position advances horizontally when the glyph is drawn using horizontal te

@LuisSevillano
LuisSevillano / autonomous_regions.json
Created August 14, 2019 18:51
Preprojected TopoJSON
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@LuisSevillano
LuisSevillano / combineHeaders.R
Last active August 8, 2019 17:57
A R function to deal with datasets with a double header
library(tidyverse)
library(ggplot2)
library(janitor)
library(readxl)
filePath <- "data/4247.xlsx"
csv <- read_xlsx(filePath, skip = 6)
# This function fills empty cells with previous values to the right and then combine them with the row above
@LuisSevillano
LuisSevillano / .block
Last active May 23, 2019 19:20
Rivers of Spain
border: none
height: 650
@LuisSevillano
LuisSevillano / query.sql
Created February 28, 2019 11:02
Add new column in PostgreSQL with a subquery and set a NOT NULL constraint
BEGIN;
ALTER TABLE table1 ADD COLUMN exp_id text;
UPDATE table1
SET exp_id = temp_query.exp_id
FROM (
SELECT t2.exp_id FROM table2 t2 JOIN table1 t1 on t2.gid = t1.gid
) AS temp_query;