Skip to content

Instantly share code, notes, and snippets.

@jdub233
jdub233 / gist:fd5f9390b87251204be7e473e2db66f4
Created April 15, 2026 14:24
wp upload for pdf accessibility check
add_filter( 'wp_handle_upload', 'my_pdf_accessibility_check', 20, 2 );
function my_pdf_accessibility_check( $upload, $context ) {
// $upload has: file, url, type if no error. [web:24]
if ( ! empty( $upload['error'] ) ) {
return $upload;
}
// Only care about Media Library uploads.
if ( $context !== 'upload' ) {
@jdub233
jdub233 / settings.xml
Created November 22, 2025 16:39
settings for TRANSFORM as installed in MIT
<x_pos>65.000000000</x_pos>
<y_pos>106.000000000</y_pos>
<width>534.000000000</width>
<height>142.000000000</height>
<name>TRANSFORM</name>
<near_clip>1600</near_clip>
<far_clip>2550</far_clip>
<near_threshold>35000</near_threshold>
@jdub233
jdub233 / .wp-env.json
Created October 6, 2021 22:03
base .wp-env.json for BU
{
"core": "WordPress/WordPress#5.4.2",
"themes": ["bu-ist/responsive-framework"],
"plugins": [ "." ]
}
@jdub233
jdub233 / stats.sh
Created May 29, 2020 15:52
backstopjs stats for multiple sites
#!/bin/bash
DIR='/app/vrt-sites-data/'
DOMAIN='www.bu.edu'
REPORT_SUBDIR='/backstop_data/bitmaps_test/'
for SITEDIR in ${DIR}${DOMAIN}/*
do
@jdub233
jdub233 / wp-url-scripts.txt
Last active April 29, 2020 21:35
For generating testing urls
wp post-type list --public=1
wp shell
wp_count_posts('post')->publish;
wp_count_posts('page')->publish;
wp post list --post_type="page" --field=url | shuf -n 50 >> urls.txt
@jdub233
jdub233 / docker-compose.yml
Last active March 31, 2020 20:41
memcached docker swarm
version: '3.2'
services:
memcached:
image: memcached:1.6
command:
- '-m 2048 -c 1024 -I 3m'
ports:
- target: 11211
published: 11211
<?php
function generate_uid( $post_id, $existing_uid_count ) {
// Generate a random seed. Leverages more cryptogaphic oriented functions for more reliable uniqueness.
$uid_int_seed = $post_id * $existing_uid_count * random_int(100000,1000000);
// Generate a hash to make an alpha numeric string.
$uid_hash = md5($uid_int_seed);
// Return last 6 characters of the random hash.
@jdub233
jdub233 / gist:707ba80ab0ffe8111d1616f47ea4dbe2
Created March 13, 2017 18:28
fetch-attachment-taxonomy.js
var media_taxonomies = new wp.api.collections.Taxonomies();
var mt_promise = media_taxonomies.fetch(
{'data': {'type':'attachment'}
});
mt_promise.complete( function() {
var media_tax1 = media_taxonomies.models[0];
console.log(media_tax1);
});