Skip to content

Instantly share code, notes, and snippets.

View CraigglesO's full-sized avatar
🌎
Sic Parvis Magna

地図の神様 CraigglesO

🌎
Sic Parvis Magna
View GitHub Profile
@CraigglesO
CraigglesO / style.spec.ts
Last active October 2, 2023 11:21
New Style Spec
export type Properties = Record<string, Value>
export type ConditionFunction = (input: string | number, properties: Properties) => boolean
export type FilterFunction = (properties: Properties) => boolean
export interface Conditional {
keyCondition?: {
key: string
keyFunction: ConditionFunction
@CraigglesO
CraigglesO / index.html
Created November 10, 2023 18:46
Example bug report on pattern loading
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Step Zoom bug</title>
<script src='./dist/maplibre-gl-dev.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
</head>
<body>
@CraigglesO
CraigglesO / bun-test-badge.ts
Created May 25, 2024 15:31
Create a basic badge for bun tests.
const svg = `
<svg xmlns="http://www.w3.org/2000/svg" width="104" height="20">
<script/>
<linearGradient id="a" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<rect rx="3" width="60" height="20" fill="#555"/>
<rect rx="3" x="50" width="54" height="20" fill="@color@"/>
<path fill="@color@" d="M64 0h4v20h-4z"/>
@CraigglesO
CraigglesO / s2tiles.ts
Created May 28, 2024 16:44
Cloud Optimized S2 Tile spec
import fs from 'fs'
import zlib, { brotliCompressSync, brotliDecompressSync } from 'zlib'
import * as S2CellID from 's2projection/s2CellID'
import type { Face } from 's2projection'
/** Types **/
type DrawType = 1 | 2 | 3 | 4 // 1: points, 2: lines, 3: poly
type Node = [number, number]