Skip to content

Instantly share code, notes, and snippets.

@abatko
abatko / 2022-US-zip-codes-abatko.csv
Last active September 17, 2024 13:53
All US zip codes from 2022 Government Data, with geolocations (latitude and longitude coordinates), comma delimited. Source: https://www.census.gov/geographies/reference-files/time-series/geo/gazetteer-files.html > ZIP Code Tabulation Areas > Download the ZIP Code Tabulation Areas Gazetteer File. Based on https://gist.github.com/abatko/ee7b24db8…
We can't make this file beautiful and searchable because it's too large.
ZIP,LAT,LNG
00601,18.180555, -66.749961
00602,18.361945, -67.175597
00603,18.457399, -67.124867
00606,18.158327, -66.932928
00610,18.293960, -67.127182
00611,18.276316, -66.807165
00612,18.416727, -66.700090
00616,18.420412, -66.671979
00617,18.446889, -66.561154
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active February 12, 2025 20:50
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@jakub-g
jakub-g / async-defer-module.md
Last active February 28, 2025 14:35
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

@diverted247
diverted247 / README
Last active November 14, 2024 22:01
Export slides from Google Slides as SVG - Console Script (Chrome tested)
To export SVG from Google Slides.
1. Open Slide deck.
2. View -> 100%
3. Click on every thumbnail from first to last, this puts the SVG into the DOM.
4. Paste the export.js in the console.
5. Make sure to allow multiple downloads.
6. All SVG should be in Downloads folder.
Cheers,
@schlamar
schlamar / processify.py
Last active October 9, 2024 12:18
processify
import os
import sys
import traceback
from functools import wraps
from multiprocessing import Process, Queue
def processify(func):
'''Decorator to run a function as a process.
Be sure that every argument and the return value