Skip to content

Instantly share code, notes, and snippets.

View jonchurch's full-sized avatar
♥️

Jon Church jonchurch

♥️
View GitHub Profile
@jonchurch
jonchurch / index.md
Last active November 20, 2025 21:42
building lodash docs html to copy over to the lodash.com repo

Building Lodash Documentation HTML

Steps

# 1. Switch to Node 11
nvm use 11

# 2. Install dependencies (if not done yet)
npm install
@jonchurch
jonchurch / rank.md
Last active November 12, 2025 06:51
lodash.foo pacakges downlaod stats

Lodash Package Download Stats

Main lodash package: 319.8M/month (80M/wk)

Total lodash.foo packages: 2.6B/month (649M/wk)

Grand Total (lodash + lodash.foo): 2.9B/month (728.9M/wk)

Table of Contents

@jonchurch
jonchurch / 0-bigquery.sql
Last active October 19, 2025 01:15
top dependents of tape v4
SELECT DISTINCT Dependent.Name AS package_name, Dependent.Version AS pkg_version
FROM `bigquery-public-data.deps_dev_v1.DependentsLatest`
WHERE System = 'NPM'
AND Name = 'tape'
AND Version LIKE '4.%' -- resolved to tape 4.x
AND MinimumDepth = 1 -- direct dependents only
AND DependentIsHighestReleaseWithResolution; -- latest release of each dependent
@jonchurch
jonchurch / 0_query.sql
Last active September 15, 2025 17:50
Which npm package has the largest version number? with Google BigQuery
-- Largest single semver component seen for npm packages
WITH parsed AS (
SELECT
Name,
Version,
SAFE_CAST(REGEXP_EXTRACT(Version, r'^(\d+)') AS INT64) AS major,
SAFE_CAST(REGEXP_EXTRACT(Version, r'^\d+\.(\d+)') AS INT64) AS minor,
SAFE_CAST(REGEXP_EXTRACT(Version, r'^\d+\.\d+\.(\d+)') AS INT64) AS patch
FROM `bigquery-public-data.deps_dev_v1.PackageVersionsLatest`
WHERE System = 'NPM'
flowchart LR
    %% Configuration for better alignment
    linkStyle default interpolate basis

    FAB_MATS["<div style='padding:8px;min-width:140px;text-align:right;' class='node-container '><div class='node-title' style='text-align:center !important;font-size:0.9em;'>FAB_MATS</div><div class='node-details' style='text-align:right !important;'><div style='text-align:right !important;'><span class='supply-abundant'>ABUNDANT</span> · <span class='activity-restricted'>RESTRICTED</span></div><div style='text-align:right !important;'>1,170c · v:20</div><div style='text-align:right !important;'>X1-RX40-F49</div></div><div style='text-align:right !important;'>RX40</div></div>"]
    class FAB_MATS activity-restricted
    class FAB_MATS export-item

    IRON["<div style='padding:8px;min-width:140px;text-align:right;' class='node-container '><div class='node-title' style='text-align:center !important;font-size:0.9em;'>IRON</div><div class='node-details' style='text-align:right !important;'><div style='text
@jonchurch
jonchurch / abnf_cheatsheet.md
Created January 14, 2025 21:57
ABNF Cheatsheet for HTTP Specs

ABNF/HTTP Syntax Cheatsheet

Basic ABNF Operators

Operator Meaning
= Defines a rule. Example: rule-name = value
/ Logical OR (choice). Example: A / B means "A or B".
* Zero or more occurrences. Example: *DIGIT means "0 or more DIGITs".
1* One or more occurrences. Example: 1*DIGIT means "1 or more DIGITs".
[ ] Optional (zero or one occurrence). Example: [DIGIT] means "optional DIGIT".
@jonchurch
jonchurch / getReleases.sh
Created November 10, 2024 20:02
Get all GH releaes from a repo in a flat file, using gh cli
#!/bin/sh
# Check if gh CLI is installed
if ! command -v gh >/dev/null 2>&1; then
echo "Error: GitHub CLI (gh) is not installed. Please install it to continue." >&2
exit 1
fi
# Check if a repository identifier was provided
if [ -z "$1" ]; then
@jonchurch
jonchurch / 1orgStats.sh
Last active April 12, 2024 08:00
Given a github org, get the npm registry download stats for the past week
#!/bin/bash
# Exit on error, uninitialized variable use, and catch errors in pipelines
set -euo pipefail
# set -x
# Initialize the DEBUG flag
DEBUG=false
# Process command-line arguments
@jonchurch
jonchurch / orgs.json
Last active February 24, 2024 20:45
Unique github orgs in express package.json deps. Keys are github orgs, array values are (npm) package names
{
"jshttp": [
"accepts",
"content-disposition",
"content-type",
"cookie",
"etag",
"fresh",
"http-errors",
"methods",
[alias]
root = rev-parse --show-toplevel
pr = "!f() { git fetch -fu ${2:-upstream} refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f"
conflicts = diff --name-only --diff-filter=U
fix = "!f() { ${EDITOR} `git conflicts`; }; f"