Skip to content

Instantly share code, notes, and snippets.

View tordans's full-sized avatar

Tobias tordans

View GitHub Profile
@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 / 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) {
{
"#": "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 / index.html
Last active January 5, 2022 20:52
iD Editor Preset Preview Experiment
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>iD Test</title>
<link rel="stylesheet" href="dist/iD.css" />
<link
rel="icon"
type="image/png"
href="data:image/png;base64,iVBORw0KGgo="
@tordans
tordans / README.md
Last active December 21, 2021 13:40
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Notizen zu Tobias' Vortrag auf dem DataCycle Meetup am 15.01.2019.

Die Notizen sind nicht selbsterklärend. Aber wer da war, findet hier alle Links die ich gezeigt habe.

@tordans
tordans / application_helper.rb
Created September 27, 2010 12:47
Eine pragmatische Lösung für das Übersetzungsproblem der Rails Methode distance_of_time_in_words(). Im Deutschen wird je nach Satzbau eine andere Ausgabe benötigt.
# ---
# Code gehört in app/helpers/application_helper.rb (oder einen anderen Helper…)
# ---
# Ausgabe: "Vor mehr als 5 Monaten"/"Vor etwa einem Jahr" — statt "Dauer: mehr als 5 Monate"/"Dauer: etwa 1 Jahr", wie es die Originalfunktion liefert
# Original-File: actionpack/lib/action_view/helpers/date_helper.rb, line 63
# Dokumenation: http://apidock.com/rails/v2.3.8/ActionView/Helpers/DateHelper/distance_of_time_in_words
# Changelog: I18n.with_options-Scope geändert auf "distance_in_words_gebeugt"
def distance_of_time_in_words_gebeugt(from_time, to_time = 0, include_seconds = false, options = {})
from_time = from_time.to_time if from_time.respond_to?(:to_time)
@tordans
tordans / README.md
Last active September 30, 2019 23:33
Vereinfachte Verkehrsordnungswidrigkeitenanzeige bei Halt- und Parkverstößen
@tordans
tordans / fluid_gmail.js
Last active November 9, 2018 17:43 — forked from itod/fluid_gmail.js
Gmail Fluid App Userscript
// use for patterns:
// *gmail.com*
// *mail.google.com*
// *google.com*mail*
// Initialize Badge so we see that this works
window.fluid.dockBadge = 99;
// Updater
setTimeout(updateDockBadge, 1000);