Skip to content

Instantly share code, notes, and snippets.

function collage(imgUrls, canvas) {
const options = {
margin: 4,
spacing: 2,
borderRadius: 5
}
const ctx = canvas.getContext('2d')
const { width, height } = canvas
const drawWidth = width - 2 * options.margin
<!DOCTYPE html>
<html>
<head>
<title>Laserkarta Gbg Norr</title>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.css">
<link rel="stylesheet" href="https://cdn.rawgit.com/ardhi/Leaflet.MousePosition/master/src/L.Control.MousePosition.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet-src.js" type="text/javascript"></script>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
perl 0.60 2482
larchii 1.51 2988
Frog's Theme 1.02 2735
jntn 1.13 2617
vico 0.74 2395
arniestone 0.38 2002
ouilly_bob 0.64 2455
ulken 0.91 2512
wishpishh 1.19 2454
mikael.egner 0.25 1130
@perliedman
perliedman / click-through-layers.js
Created March 7, 2017 15:11
Click through multiple layers of Leaflet VectorGrid
// Since overlays are VectorGrid layers with canvas rendering,
// they don't support clicking through them (the topmost canvas
// swallows the event, lower layers will not see it).
// We workaround this by this hack (inspired by
// http://www.vinylfox.com/forwarding-mouse-events-through-layers/):
//
// All overlays are in their own Leaflet pane. When a click hits a
// layer in the pane, we first handle the event like normal, and then
// hit the event handler below this comment.
//
@perliedman
perliedman / round-robin-route-control.js
Created December 5, 2016 08:04
Round Robin Routing Control
var RoundRobinPlan = L.Routing.Plan.extend({
initialize: function(waypoints, options) {
L.Routing.Plan.prototype.initialize.call(this, waypoints, options);
},
dragNewWaypoint: function(e) {
var nWps = this._waypoints.length,
insertionIndex = e.afterIndex > nWps - 1 ? 0 : e.afterIndex + 1,
i,
marker,
@perliedman
perliedman / secondsToTime.js
Created October 27, 2016 12:20
Convert a number of seconds as integer to a string of hours, minutes and seconds (HH:MM:SS)
var secondsToTime = function(s) {
var pad = function(v) {
return v < 10 ? '0' + v : v.toString();
}
var result = '';
for (var i = 0; i < 3; i++) {
result = pad(s % 60) + (i ? ':' : '') + result;
s = Math.floor(s / 60);
}
#!/bin/bash
LL="31 70"
P0=`echo $LL | cs2cs +proj=longlat +datum=WGS84 +no_defs +to +proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs`
for I in `seq 1 10`;
do
P=`echo $LL | cs2cs +proj=longlat +datum=WGS84 +no_defs +to +proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs`
LL=`echo $P | cs2cs -I +proj=longlat +datum=WGS84 +no_defs +to +proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs`
done
@perliedman
perliedman / leaflet_1_0.svg
Last active April 18, 2016 14:22
Leaflet-1.0-verified
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@perliedman
perliedman / leaflet-plugins.csv
Created April 18, 2016 13:43
Leaflet plugin data
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 6 columns, instead of 4. in line 8.
Name,Era,Last commit,URL,Maintainer,Maintainer URL
azgs-leaflet,really old,2012-05-02T00:22:23Z,https://github.com/azgs/azgs-leaflet,AZGS,https://github.com/azgs
RaphaelLayer,0.5,2013-01-17T12:42:48Z,http://dynmeth.github.com/RaphaelLayer/,Dynamic Methods,https://github.com/dynmeth
Leaflet.MultiTileLayer,0.5,2013-02-25T16:34:13Z,https://github.com/mattiasb/Leaflet.MultiTileLayer,Mattias Bengtsson,https://github.com/mattiasb
leaflet.pouch,0.5,2013-04-25T18:01:21Z,https://github.com/calvinmetcalf/leaflet.pouch,Calvin Metcalf,https://github.com/calvinmetcalf/
Leaflet.RevealOSM,0.5,2013-05-28T13:06:41Z,https://github.com/yohanboniface/Leaflet.RevealOSM,Yohan Boniface,http://yohanboniface.me
leaflet.zoomfs,0.6,2013-07-28T19:21:50Z,http://elidupuis.github.com/leaflet.zoomfs,Eli Dupuis,https://github.com/elidupuis
Leaflet.BorderPan,0.6,2013-08-09T01:49:26Z,https://github.com/slara/Leaflet.BorderPan,Sebastián Lara,https://github.com/slara
Leaflet.dbpediaLayer,0.6,2013-09-14T21:51:05Z,https://github.com/kr1/Leaflet.db