Skip to content

Instantly share code, notes, and snippets.

View adamziel's full-sized avatar
👋

Adam Zieliński adamziel

👋
View GitHub Profile
@adamziel
adamziel / composer-fast-resolve.php
Created December 4, 2025 13:13
Composer fast resolve
#!/usr/bin/env php
<?php
/**
* Composer Fast Resolve - Fast parallel dependency resolution
*
* Resolves all transitive dependencies from a composer.json and outputs
* a new composer.json with all dependencies explicitly listed.
*
* Usage:
* php composer-shrinkwrap.php composer.json > composer-shrinkwrap.json
@adamziel
adamziel / blueprint.json
Last active November 14, 2025 12:54
Ship mysqli functions with sqlite
{
"plugins": ["wp-staging"],
"steps": [
{
"step": "writeFile",
"path": "/wordpress/wp-content/mu-plugins/shim_mysqli.php",
"data": {
"resource": "url",
"url": "https://gist.githubusercontent.com/adamziel/51ac62858a97937a84a4c4b9e8dea463/raw/9185e69fc9e7d36f276e72aba92944107fd94bed/shim_mysqli.php"
}
@adamziel
adamziel / 0. README.md
Last active November 27, 2025 12:38
URL Rewriting in WordPress importer demo

URL Rewriting in WordPress importer demo.

@adamziel
adamziel / 0 PHP substring comparison benchmark.md
Last active November 5, 2025 17:06
PHP String Comparison Benchmarks

PHP String Comparison Benchmark Results

Performance comparison of different string matching methods in PHP.

Case-Sensitive Comparison Results

Test Setup:

  • String length: 76,000 bytes
  • Iterations: 1000 per method
  • Each test run was a separate, sequential php CLI call to minimize interference
@adamziel
adamziel / serve_syntax_highlighted_php_file_in_chrome_devtools.py
Created September 2, 2025 14:29
Syntax-highlighted, debuggable PHP in CDP
"""
Serves a syntax-highlighted, source-mapped, debuggable file to Chrome devtools
over the CDP protocol.
"""
import asyncio
import websockets
import json
import base64
@adamziel
adamziel / re-run.fish
Created July 5, 2025 21:32
Debugging Asyncify functions in Playground
rm out.txt
PHP=7.4 node --stack-trace-limit=100 --loader=./packages/meta/src/node-es-module-loader/loader.mts ./packages/php-wasm/cli/src/main.ts test.php &> out.txt
cat out.txt | bun packages/meta/bin/verify-asyncify-functions.ts
@adamziel
adamziel / build.mjs
Created June 23, 2025 22:28
esbuild support for ?url
// build.mjs
import esbuild from 'esbuild'
import importUrlPlugin from './import-url-plugin.ts'; // the plugin shown earlier
await esbuild.build({
entryPoints: ['src/index.ts'],
bundle: true,
outdir: 'build',
format: 'esm',
platform: 'browser', // change to 'node' if you bundle for Node
@adamziel
adamziel / data-liberation-boilerplate.php
Last active June 4, 2025 12:31
Data Liberation Boilerplate
<?php
/**
* Data Liberation Boilerplate
* 1. Clone the https://github.com/wordPress/php-toolkit/ repo
* 2. Switch to branch push-qvpwqtzqzyrw (this PR https://github.com/WordPress/php-toolkit/pull/127)
* 3. Put this file in the repo root
* 4. Adjust the require paths below
* 5. Run the script
*
@adamziel
adamziel / PostgreSQL driver for WordPress
Last active May 22, 2025 11:07
PostgreSQL driver for WordPress
Can you run WordPress on PostgreSQL?
Not yet, but this Gist gets you closer. This is a PostgreSQL driver
for https://github.com/Automattic/sqlite-database-integration. I've
generated it by asking AI to port the SQLite driver to PostgreSQL driver.
It parses a MySQL query and runs a corresponding PostgreSQL query. Some
queries work, some don't, the escaping is a mess, but it's a good first draft.
@adamziel
adamziel / 0-Requesting WordPress Playground from the internet.md
Last active May 22, 2025 11:07
Requesting WordPress Playground from the internet

A simple demo of how a WordPress Playground instance running in the web browser could be reached from the outside world.

The data flow:

  1. The browser receives a unique session ID
  2. The browser connects via a long-lived connection to gateway.php (SSE)
  3. An external caller sends a HTTP request to the gateway (with session ID).
  4. Gateway stalls, stores the request details on the disk
  5. The browser receives request details via the long-lived connection