Skip to content

Instantly share code, notes, and snippets.

View josephscott's full-sized avatar

Joseph Scott josephscott

View GitHub Profile
@josephscott
josephscott / coredump.txt
Created December 9, 2015 22:28
HHVM nightly - hhvm-nightly-dbg_2015.12.09~wheezy_amd64.deb - core dump
Thread 3 (Thread 0x7f47303ff700 (LWP 29153)):
#0 0x00007f473ef6cd63 in epoll_wait () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f474060a5d3 in ?? ()
from /usr/lib/x86_64-linux-gnu/libevent-2.0.so.5
#2 0x00007f47405f5f60 in event_base_loop ()
from /usr/lib/x86_64-linux-gnu/libevent-2.0.so.5
#3 0x000000000634b2fd in folly::EventBase::loopBody(int) ()
at /tmp/tmp.hEWUdoldcP/third-party/folly/src/folly/io/async/EventBase.cpp: 347
#4 0x000000000634af95 in folly::EventBase::loop() ()
at /tmp/tmp.hEWUdoldcP/third-party/folly/src/folly/io/async/EventBase.cpp: 299
document.addEventListener("DOMContentLoaded", function() {
var lazyImages = [].slice.call(document.getElementsByClassName("js-lazy-img"));
if ("IntersectionObserver" in window) {
var config = {
// If the image gets within 250px of the browser's viewport, start the download:
rootMargin: '250px 0px',
};
var lazyImageObserver = new IntersectionObserver(function(entries, observer) {
document.addEventListener("DOMContentLoaded",function(){var e=[].slice.call(document.getElementsByClassName("js-lazy-img"));if("IntersectionObserver"in window){var t=new IntersectionObserver(function(e,s){e.forEach(function(e){if(e.isIntersecting){var s=e.target;s.src=s.dataset.src,s.dataset.srcset&&(s.srcset=s.dataset.srcset),t.unobserve(s)}})},{rootMargin:"250px 0px"});e.forEach(function(e){t.observe(e)})}else e.forEach(function(e){e.src=e.dataset.src,e.dataset.srcset&&(e.srcset=e.dataset.srcset)})});
@josephscott
josephscott / wait-ttfb
Last active May 19, 2021 21:19
Get the app response TTFB ( Time To First Byte ) with curl
#!/usr/bin/env bash
set -eu
export LC_ALL=C.UTF-8
CURL_FORMAT="%{time_starttransfer} - %{time_pretransfer}"
declare -a TIMES
for i in {1..15}; do
OUT_CURL=$(curl -w "$CURL_FORMAT" -k --compressed -s -o /dev/null "$@")
@josephscott
josephscott / Caddyfile
Last active May 23, 2025 19:00
FrankenPHP Caddyfile, WordPress sub-directory for local dev
{
frankenphp {
php_ini max_execution_time 300
php_ini memory_limit 256M
php_ini upload_max_filesize 128M
php_ini post_max_size 128M
}
}
@josephscott
josephscott / bench-prepend-to-selector.php
Last active June 24, 2026 17:27
Gutenberg: prepend_to_selector() comparison
<?php
/**
* Benchmark: prepend_to_selector() implementations.
*
* Compares the current trunk implementation (split_selector_list)
* against the optimized version (str_replace fast path + split_selector_list fallback).
*
* Usage: php bench-prepend-to-selector.php
*/
@josephscott
josephscott / tests-functions.php
Created April 2, 2026 21:18
wp_normalize_path split test fix
/**
* Tests that wp_normalize_path() static cache stores results.
*
* Uses ReflectionFunction::getStaticVariables() to inspect the cache.
*
* Skipped on PHP 8.1 and 8.2 because OPcache's Dead Code Elimination
* incorrectly treats ZEND_BIND_STATIC as side-effect-free for static
* variables with simple initializers, causing getStaticVariables() to
* return compile-time defaults instead of runtime values. Fixed in
* PHP 8.3 via PR #9301 (arbitrary static variable initializers RFC).