Skip to content

Instantly share code, notes, and snippets.

Avatar
🐢

Gregor Aisch gka

🐢
View GitHub Profile
@gka
gka / index.html
Last active Sep 28, 2020
external tooltips
View index.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title></title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow">
<meta name="googlebot" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet href="https://cdn.jsdelivr.net/npm/bulma@0.9.0/css/bulma.min.css">
View App.html
<h1>Hello {chart.title} (svelte 2)!</h1>
<input type="text" bind:value="chart.title" />
<div class="svelte3-here" style="border:2px solid red"></div>
<script>
import AppV3 from './bundle.js';
let app;
View neighborhoods.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gka
gka / .gitignore
Last active Nov 20, 2020
covid19 berlin cases
View .gitignore
.Rhistory
.Rproj.user
covid19-berlin.Rproj
.Renviron
View corona-scraper.R
# ---------------------
# This is the R script that generates the charts, maps and tables for the Datawrapper blog post http://blog.datawrapper.de/coronavirus-charts, written by Lisa Charlotte Rost.
# This is NOT great R code. It works, but much of it could have been achieved with shorter code, more elegant, more efficiently, less confusing and without so many libraries; especially the further you go down the script (I got better in the process, among others thanks to my coworker Gregor Aisch who's still a R pro). Please don't use this code to learn R.
# ---------------------
# load libraries
needs(dplyr, readr, reshape2, jsonlite, data.table, tidyr, htmltab, zoo)
# ^ if this command fails, run
@gka
gka / better-slack.css
Created Apr 8, 2020
this style helps me get along with the recent slack redesign
View better-slack.css
@-moz-document url-prefix("https://app.slack.com") {
.p-top_nav {
background: transparent !important;
box-shadow: none;
pointer-events: none;
}
.p-workspace {
margin-top:-38px;
}
.p-top_nav__sidebar {
@gka
gka / corona-growth.R
Created Mar 25, 2020
covid-19 cases growth rates
View corona-growth.R
needs(dplyr, readr, reshape2, tidyr, zoo)
read_csv("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv") %>%
rename(country = `Country/Region`,
province = `Province/State`) %>%
select(-Lat, -Long) %>%
pivot_longer(-c(country, province), names_to = "date", values_to = "confirmed") %>%
mutate(date = as.Date(date, "%m/%d/%y")) %>%
mutate(country = ifelse(country == "China" & province == "Hong Kong",
"Hong Kong", country)) %>%
@gka
gka / App.svelte
Last active Mar 6, 2019
svelte 3 lazyload example
View App.svelte
<h1>lazyload example</h1>
{#each [0,1,2,3,4,5,6,7,8,9] as i}
<p>Scroll down to load the images. Quo et qui laboriosam rerum. Animi et quia consequuntur quas sit eaque molestias. Accusamus voluptate nulla eligendi. Dolores labore ea asperiores ut voluptas dolorem. Cupiditate in enim quibusdam. Quas quae aliquam sed repellat laboriosam inventore est.</p>
<img alt="random image" use:lazyload src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAABCAQAAABeK7cBAAAAC0lEQVR42mNkAAIAAAoAAv/lxKUAAAAASUVORK5CYII=" data-src="https://picsum.photos/500/300/?image={i}" />
{/each}
<script>
import { lazyload } from './lazyload.js';
</script>
@gka
gka / .block
Last active Sep 13, 2019
summer-heat
View .block
license: mit
@gka
gka / index.js
Created Dec 11, 2018
Quick demo of using only parts of chroma.js
View index.js
require('chroma-js/src/io/hex');
require('chroma-js/src/io/lab');
const chroma = require('chroma-js/src/chroma');
console.log(chroma('#cc7d8e').lab());
You can’t perform that action at this time.