Skip to content

Instantly share code, notes, and snippets.

View tmcw's full-sized avatar
💭
merging your prs

Tom MacWright tmcw

💭
merging your prs
View GitHub Profile
┌───────────────────────────────────────────┬────────────────────────┐
│ Package │ License │
├───────────────────────────────────────────┼────────────────────────┤
│ @placemarkio/turf-jsts │ (EDL-1.0 OR EPL-1.0) │
├───────────────────────────────────────────┼────────────────────────┤
│ sha.js │ (MIT AND BSD-3-Clause) │
├───────────────────────────────────────────┼────────────────────────┤
│ pako │ (MIT AND Zlib) │
├───────────────────────────────────────────┼────────────────────────┤
│ @maplibre/mlt │ (MIT OR Apache-2.0) │

Mapbox made their map renderer, Mapbox GL, closed-source in 2020. I left in 2017 so wasn't involved in this decision, but I worked on Mapbox GL and know the rest of the narrative. Mapbox was part of a wave of open-core startups that released the core of their products as open source and were able to make a decent business as well as do a good thing for the world. The amount of time and money that Mapbox put into open source code is pretty unrivaled. But, big competitors started just running the same versions of the same software for cheaper and the vibes shifted and so decisions like this one was made.

MapLibre started as a fork of Mapbox GL 1.x, the open source version, and has evolved a lot since then but still owes a lot to the original. The maintainers are very cool about this and the repo makes the lineage clear. But there's a narrative of rebelling against the corporation by using a version of the code open sourced by the corporation. That narrative hurts because I saw both the effort put into the i

import express from "express";
const app = express();
app.use(express.json());
function factorial(n) {
if (n === 1) return 1;
return n * factorial(n - 1);
}
export default async (req) => {
const headers = {
'Content-Type': 'text/css',
'Netlify-Vary': 'cookie=scheme',
'Vary': 'Cookie',
// max-age in seconds = cache for 1 hour
'Netlify-CDN-Cache-Control': 'public, max-age=3600, stale-while-revalidate=120',
'Cache-Control': 'public, max-age=360'
};
if (req.method === 'GET') {

Tampermonkey userscripts for automatically adding credit card offers

import {
encodeBase64,
decodeBase64,
} from "https://deno.land/std/encoding/base64.ts";
import process from "node:process";
import SuperJSON from "npm:superjson@2.1.0";
SuperJSON.registerCustom(
{
isApplicable: (v: any): v is Function => typeof v === "function",
import { getCollection } from "astro:content";
import type { APIRoute } from "astro";
export async function getStaticPaths() {
const docs = await getCollection("docs");
return docs.map((doc) => ({
params: { slug: doc.slug },
props: doc,
}));
}
import { Draft2019 } from "json-schema-library";
console.log(Draft2019);
@tmcw
tmcw / README.md
Last active May 28, 2024 13:49
CodeMirror extension to detect and fix missing JSX Pragma

We make JSX configuration a per-val setting by requiring a jsxPragma: https://docs.deno.com/runtime/manual/advanced/jsx_dom/jsx

But most code doesn't do that and relies on a project-wide jsx setting. So, to provide better DX for missing JSX pragmas, we use this CodeMirror extension that detects the lack of a pragma and the presence of JSX syntax, by using CodeMirror's existing syntax tree.

There are two options for the Placemark Globe dataset:

Visionscarto

This is "Visionscarto’s “World Atlas”, which is very well-described by the linked document. It's based on Natural Earth but includes some changes:

  • Western Sahara as the UN point of view
  • Crimea as part of Ukraine
  • Increased width of Gaza strip to avoid it being removed by simplification