Skip to content

Instantly share code, notes, and snippets.

@milkbread
milkbread / readme.md
Last active July 24, 2022 22:16
MD: Readme.md styling test

How to structure a readme file

Tutorial and cheat sheet in one file!

Headings are indicated by one or more #hashtags, while...

... it is getting smaller, and smaller...

Add a line by just adding 3 hyphens

@milkbread
milkbread / index.html
Last active April 20, 2021 03:44
JavaScript: Leaflet Polygon Example
<!DOCTYPE html>
<html>
<head>
<title>Simple polygon visualisation</title>
<meta charset="utf-8" />
<script src="http://cdn.leafletjs.com/leaflet-0.6.1/leaflet.js"></script>
<script src="http://d3js.org/d3.v3.min.js"></script>
<style>
@import url(http://cdn.leafletjs.com/leaflet-0.6.1/leaflet.css);
</style>
@milkbread
milkbread / index.html
Last active January 26, 2021 10:22
Compare maps including shared crosshairs
<!DOCTYPE html>
<html>
<head>
<title>Compare maps</title>
<meta charset="utf-8" />
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="http://d3js.org/d3.v3.min.js"></script>
<style>
@import url(http://cdn.leafletjs.com/leaflet-0.6.1/leaflet.css);
@milkbread
milkbread / index.html
Created September 5, 2013 12:12
JavaScript: UTFGrid demonstration I
<!DOCTYPE html>
<!--Source: http://danzel.github.io/Leaflet.utfgrid/example/map.html//-->
<html>
<head>
<script src="http://cdn.leafletjs.com/leaflet-0.6.1/leaflet.js"></script>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.1/leaflet.css" />
<script src="http://danzel.github.io/Leaflet.utfgrid/src/leaflet.utfgrid.js"></script>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
@milkbread
milkbread / index.html
Last active July 20, 2018 16:12
HTML: D3: TopoJSON: Sorted polygons of german states - dynamic visualisation I
<!DOCTYPE html>
<html>
<head>
<title>Testmap</title>
<meta charset="utf-8" />
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<style>
#states{
overflow-x: auto;
@milkbread
milkbread / index.html
Last active April 5, 2018 21:43
HTML: D3 Geodata Basics - example for the tutorial on digital-geography
<!DOCTYPE html>
<html>
<head>
<title>Testmap</title>
<meta charset="utf-8" />
<script src="http://cdn.leafletjs.com/leaflet-0.6.1/leaflet.js"></script>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="roads.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<style>
@milkbread
milkbread / index.html
Last active March 11, 2018 01:17
TextFitting
<!DOCTYPE html>
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="text_object.js"></script>
<title>Fitting Text into a Box</title>
<style>
#box{
fill:none;
stroke:#000;
@milkbread
milkbread / index.html
Last active January 23, 2017 17:06
JavaScript: Convert GeoJSON to WKT I
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<title>Convert GeoJSON</title>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="route.js"></script>
</head>
@milkbread
milkbread / d3.v3.min.js
Last active September 2, 2016 00:47
Find intersections of a line segment and a circle
!function(){function n(n){return null!=n&&!isNaN(n)}function t(n){return n.length}function e(n){for(var t=1;n*t%1;)t*=10;return t}function r(n,t){try{for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}catch(r){n.prototype=t}}function u(){}function i(n){return aa+n in this}function o(n){return n=aa+n,n in this&&delete this[n]}function a(){var n=[];return this.forEach(function(t){n.push(t)}),n}function c(){var n=0;for(var t in this)t.charCodeAt(0)===ca&&++n;return n}function s(){for(var n in this)if(n.charCodeAt(0)===ca)return!1;return!0}function l(){}function f(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function h(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.substring(1);for(var e=0,r=sa.length;r>e;++e){var u=sa[e]+t;if(u in n)return u}}function g(){}function p(){}function v(n){function t(){for(var t,r=e,u=-1,i=r.length;++u<i;)(t=r[u].on)&&t.apply(this,arguments);return n}var e=[],r=new u;return t.on=function(t,u){var i,o=r.get(t);return arguments
@milkbread
milkbread / d3.v3.min.js
Last active September 2, 2016 00:46
Testing quadtrees
!function(){function n(n,t){return t>n?-1:n>t?1:n>=t?0:0/0}function t(n){return null!=n&&!isNaN(n)}function e(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function r(n){return n.length}function u(n){for(var t=1;n*t%1;)t*=10;return t}function i(n,t){try{for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}catch(r){n.prototype=t}}function o(){}function a(n){return ha+n in this}function c(n){return n=ha+n,n in this&&delete this[n]}function s(){var n=[];return this.forEach(function(t){n.push(t)}),n}function l(){var n=0;for(var t in this)t.charCodeAt(0)===ga&&++n;return n}function f(){for(var n in this)if(n.charCodeAt(0)===ga)return!1;return!0}function h(){}function g(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function p(n,