This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Mapbox GL JS debug page</title> | |
<meta charset='utf-8'> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> | |
<link rel='stylesheet' href='/dist/mapbox-gl.css' /> | |
<style> | |
body { margin: 0; padding: 0; } | |
html, body, #map { height: 100%; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const numFeatures = 100; | |
const numPolygons = 5; | |
const numRings = 10; | |
const numPoints = 10000; | |
console.time('populate storage'); | |
const features = []; | |
for (let i = 0; i < numFeatures; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ISC License | |
Copyright (c) 2022 Volodymyr Agafonkin | |
Permission to use, copy, modify, and/or distribute this software for any | |
purpose with or without fee is hereby granted, provided that the above | |
copyright notice and this permission notice appear in all copies. | |
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | |
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Lefalet shortcuts for common tile providers - is it worth adding such 1.5kb to Leaflet core? | |
L.TileLayer.Common = L.TileLayer.extend({ | |
initialize: function (options) { | |
L.TileLayer.prototype.initialize.call(this, this.url, options); | |
} | |
}); | |
(function () { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
option optimize_for = LITE_RUNTIME; | |
message Data { | |
message FeatureCollection { | |
repeated Feature features = 1; | |
} | |
message Feature { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html, body { | |
margin: 0; | |
font-family: sans-serif; | |
} | |
#map { | |
position: absolute; | |
top: 45px; | |
bottom: 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias ..="cd .." | |
alias ...="cd ../.." | |
alias ....="cd ../../.." | |
alias .....="cd ../../../.." | |
# Shortcuts | |
alias db="cd ~/Dropbox" | |
alias dl="cd ~/Downloads" | |
alias dt="cd ~/Desktop" | |
alias p="cd ~/projects" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const N = 1000000; | |
function simpleConcat() { | |
let str = ''; | |
for (let i = 0; i < N; i++) { | |
str += 'a'; | |
} | |
return str; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var contours = require('d3-contour').contours; | |
var PNG = require('pngjs').PNG; | |
var fs = require('fs'); | |
var png = PNG.sync.read(fs.readFileSync('./rain.png')); | |
var data = []; | |
for (var i = 0; i < png.height; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getTileUrls(bounds, tileLayer, zoom) { | |
var min = map.project(bounds.getNorthWest(), zoom).divideBy(256).floor(), | |
max = map.project(bounds.getSouthEast(), zoom).divideBy(256).floor(), | |
urls = []; | |
for (var i = min.x; i <= max.x; i++) { | |
for (var j = min.y; j <= max.y; j++) { | |
var coords = new L.Point(i, j); | |
coords.z = zoom; |
NewerOlder