Skip to content

Instantly share code, notes, and snippets.

Avatar

Andy Fragen afragen

View GitHub Profile
@afragen
afragen / _Docker-wp_xDebug_AppleSilicon.md
Last active May 30, 2023 16:09
My setup for wordpress-develop Docker wp environment on Apple Silicon with xDebug active
View _Docker-wp_xDebug_AppleSilicon.md

These are the files needed for setting up the Docker wp environment for wordpress-develop with xDebug active on Apple Silicon. Currently Docker wp runs

  • PHP 7.4.33
  • xDebug 3.1.6

I created and placed the custom-php-config.ini file one level above wordpress-develop.

The docker-compose.override.yml is at the root level of wordpress-develop.

Then simply follow the instructions in the https://github.com/WordPress/wordpress-develop/blob/trunk/README.md

@afragen
afragen / .wp-env.json
Created May 24, 2023 19:26
Just an example, doesn't work for core development.
View .wp-env.json
{
"core": "WordPress/wordpress-develop#trunk",
"phpVersion": "8.1",
"plugins": [
"https://downloads.wordpress.org/plugin/query-monitor.zip"
],
"port": 8888,
"testsPort": 8889,
"config": {
"WP_DEBUG": true,
@afragen
afragen / phpcs.xml
Last active April 2, 2023 18:09
phpcs files for my plugins and core plugins
View phpcs.xml
<?xml version="1.0"?>
<ruleset name="AJF-Coding-Standards">
<description>A custom ruleset to take in account both WordPress and personal standards.</description>
<!-- Show progress and sniff codes in all reports -->
<arg value="ps"/>
<!-- Exclude these -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
@afragen
afragen / karma.php
Last active April 30, 2023 00:10
Impose karma on specific users
View karma.php
<?php
/**
* Karma.
*
* @package Fragen\Karma
*
* Plugin Name: Karma
* Plugin URI: https://gist.github.com/afragen/b45511007d0a1c07ad285ce6e223a91c
* Description: Impose karma on users.
* Version: 0.6.0
@afragen
afragen / git-updater-fastspring-popup.php
Created November 3, 2022 23:34
Add javascript for FastSpring's Git Updater popup store.
View git-updater-fastspring-popup.php
<?php
/**
* Add FastSpring popup store script for Git Updater.
*
* @package FastSpringPopUpStore
*
* Plugin Name: FastSpring Popup Store for Git Updater
* Plugin URI: https://gist.github.com/afragen/e7819dd1e17be5792c299dbef989d446
* Description: Add FastSpring popup store javascript for Git Updater.
* Version: 0.1.0
@afragen
afragen / php.ini.hbs
Last active January 11, 2023 22:29
Stuff for xDebug 3.x and Local
View php.ini.hbs
; Add to all lightning services PHP conf files using xDebug 3.x
xdebug.mode=debug
xdebug.client_port=9003
xdebug.start_with_request=trigger
xdebug.discover_client_host=yes
xdebug.idekey=VSCODE
; Add to all lightning services PHP conf files using xDebug 2.x
xdebug.remote_enable=1
xdebug.remote_connect_back=Off
@afragen
afragen / trick-auto-update.php
Created August 24, 2022 20:03
Allows one to mash the WP Crontrol 'Run now' link with abandon.
View trick-auto-update.php
/**
* Trick `WP_Automatic_Updater` into thinking there is no existing lock.
*
* By default, the auto-updater will only run once every hour even if
* the cron job is manually fired. That makes it hard to run multiple tests
* in a short period of time.
*/
add_filter(
'option_auto_updater.lock',
function ($value) {
View test-fatal.php
<?php
/**
* Auto-update fatal error check test plugin.
*
* @package AutoUpdateFatalErrorCheck
*
* Plugin Name: Auto-update Fatal Error Check Test Plugin
* Plugin URI: https://github.com/afragen/fatal-plugin
* Description: Set local version to 0 and comment code from plugin for testing.
* Version: 0.1.1
@afragen
afragen / auto-update-fatal-error-check.php
Last active August 3, 2022 17:55
Run the Rollback code if the plugin has an activation error.
View auto-update-fatal-error-check.php
<?php
/**
* Auto-update fatal error check.
*
* @package AutoUpdateFatalErrorCheck
*
* Plugin Name: Auto-update Fatal Error Check
* Plugin URI: https://gist.github.com/afragen/518819349528dba930cf7845180d5274
* Description: Check for a PHP error on plugin auto-update and deactivate plugin if one exists.
* Version: 0.4.2
@afragen
afragen / gist-oembed.php
Last active August 5, 2022 19:56
WordPress plugin to embed gists or gist files.
View gist-oembed.php
<?php
/**
* Gist oEmbed.
*
* @package Fragen\Gist_OEmbed
*
* Plugin Name: Gist oEmbed
* Plugin URI: https://gist.github.com/afragen/36ab01da116aadd27a3f4d85cce90390
* Description: oEmbed Gist or files within Gists.
* Version: 0.6.2