Skip to content

Instantly share code, notes, and snippets.

View tordans's full-sized avatar

Tobias tordans

View GitHub Profile
{
"#": "This JSON file is a small template to get you started developing a theme",
"#": "All lines starting with '#' are comments and can be removed in the theme if you don't need the explanation anymore",
"#": "Make sure to join our chat channel at https://app.element.io/#/room/#MapComplete:matrix.org for questions, sharing your theme, ...",
"#": "To actually load your theme: on linux: run a local webserver (e.g. `webfsd`) and go to https://mapcomplete.osm.be/theme?userlayout=http://127.0.0.1:8080/path-to-your-theme.json",
"#": "If you don't know how to run a webserver: go to https://www.base64encode.org/ , copy paste this entire document in the 'encode' field and encode it;",
"#": "Then, go to https://mapcomplete.osm.be/theme?userlayout=true#your-base64-encoded-file",
"id": "crossing",
"maintainer": "Crossing",
@tordans
tordans / add-use-client-to-all-files.cjs
Created October 11, 2023 08:01
Quick helper script to add `use client` to all ts/tsx files in all folders except when it was added already. (Thanks to Github Copilot for creating this.)
// 0. Stash everything in git to have a clean slate
// 1. Update `folderPath`
// 2. Run with `node add-use-client-to-all-files.cjs` from the root of your project
const fs = require('fs')
const path = require('path')
const folderPath = './src/app' // Replace with the path to your folder
function updateFilesInFolder(folderPath) {
@tordans
tordans / maplibre-number-formatting.js
Created February 3, 2024 11:23
Maplibre GL JS number formatting snipped
// Source https://osmus.slack.com/archives/C01G3D28DAB/p1706567778474359?thread_ts=1706534773.353969&cid=C01G3D28DAB
"text-field": [
"let",
"thousands",
["floor", ["/", ["get", "length_m"], 1000]],
[
"let",
"reminder",
[
@tordans
tordans / geojsonToPoly.test.ts
Created May 7, 2025 08:09
Modernized version of https://github.com/gagan-bansal/geojson2poly that can be used in a typescript file. It returns the poly fine as a string based on a input GeoJson.
import { describe, expect, it } from 'bun:test'
import type { Feature, FeatureCollection, Polygon } from 'geojson'
import { geojsonToPoly } from './geojsonToPoly'
describe('geojsonToPoly', () => {
it('should convert a simple Polygon GeoJSON to a polyline string', () => {
const geojson: Feature<Polygon, {}> = {
type: 'Feature',
properties: {},
geometry: {
@tordans
tordans / outline.md
Created May 12, 2025 21:01
Code for Berlin 2025-05-12 OSM "Was gibt es neues in der OSM- und Geo-Community"

Notizen zu "Was ist in den letzten 12 Monaten in OSM passiert in Berlin und in Deutschland" https://www.meetup.com/ok-lab-berlin/events/307692190