Skip to content

Instantly share code, notes, and snippets.

View danvk's full-sized avatar

Dan Vanderkam danvk

View GitHub Profile
const loc: [number, number] = [10, 20];
panTo(loc);
const loc: any = [10, 20];
panTo(loc);
const loc = [10, 20];
panTo(loc as any);
@danvk
danvk / valid.js
Last active January 22, 2019 20:11
const loc = [10, 20];
loc.push(30);
// Parameter is a (latitude, longitude) pair.
function panTo(where: [number, number]) { /* ... */ }
// Inline:
panTo([10, 20]); // inline: ok
// Reference:
const loc = [10, 20];
panTo(loc); // reference. Will this work?
export function purchase(what: string) { /* ... */ }
purchase('Macbook Air'); // Inline
const product = 'Macbook Air';
purchase(product); // reference
const product = 'Macbook Air';
purchase(product); // reference form
@danvk
danvk / example1.js
Last active January 22, 2019 20:08
function purchase(product) { /* ... */ }
purchase('Macbook Air');
@danvk
danvk / glitch.geojson
Created January 11, 2019 22:35
Repro of visual glitch in Mapbox GL JS
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
"""Pretty-print GeoJSON in a slightly more compact way by putting coordinates on one line.
Compare:
[
[
37.23423,
79.23423
],
var results = document.querySelectorAll('.issue-list h3 a');
var html = '';
for (const a of document.querySelectorAll('.issue-list h3 a')) {
html += `<a style="text-decoration: underline; color: #15c;" href="https://github.com/${a.getAttribute('href')}">${a.textContent}</a><br>\n`
}
var container = document.createElement('p');
container.setAttribute('style', 'font: 13px/1.5 sans-serif; margin-left: 100px; margin-bottom: 50px;');
container.innerHTML = html;
document.body.appendChild(container);
container.scrollIntoViewIfNeeded();