Skip to content

Instantly share code, notes, and snippets.

@dd32
dd32 / svn-ci-partial
Last active February 13, 2024 03:54
svn ci --partial
#!/bin/bash
# SVN ci partial support
#
# This script can be enabled with a `svn()` wrapper defined in your profile.
#
# Props need to go to authors who have attempted this in the past, particularly to
# Karljohan Lundin Palmerius for his work with using kompare:
# https://www.itn.liu.se/~karlu20/div/blog/2013-05-31_SVNPartialCommit.php
#
#!/bin/bash
# Quick script to sync all my forks on GitHub up-to-date with the parent repo
# Assumes I never commit to the main branch, which I try to avoid.
# Runs on cron, so only outputs with errors.
USER=$(gh api '/user' | jq -r .login)
REPOS=$(gh api "users/$USER/repos?type=owner&per_page=100" | jq -r '.[] | select( ( .fork == true ) and ( .disabled == false ) and ( .archived == false ) ) | .full_name + " " +.default_branch' )
while IFS= read -r line; do
<?php
add_filter( 'cli_show_cookie_bar_only_on_selected_pages', 'hide_banner_on_mshots' );
function hide_banner_on_mshots( $html ) {
if ( false !== strpos( $_SERVER['HTTP_USER_AGENT'], 'mShots' ) ) {
$html = '';
}
return $html;
<?php
/**
* Plugin Name: Redirect WordPress.org downloads through a local caching proxy.
*/
/**
* PLEASE NOTE:
* - Please only cache downloads for a short period of time, ZIPs may change even though the URL doesn't.
* - This will cause download counts to not be counted on WordPress.org.
* - downloads.wordpress.org serves: Plugins, Themes, Translations, and Core Update packages, amongst other things.
@dd32
dd32 / php56-php8-pollyfill.diff
Last active April 30, 2020 11:55
Example of altering the Symfony PHP8.0 polyfill to be parsable under PHP 5.6
diff --git a/src/Php80/Php80.php b/src/Php80/Php80.php
index ba74359..bc2533c 100644
--- a/src/Php80/Php80.php
+++ b/src/Php80/Php80.php
@@ -20,12 +20,12 @@ namespace Symfony\Polyfill\Php80;
*/
final class Php80
{
- public static function fdiv(float $dividend, float $divisor): float
+ public static function fdiv(float $dividend, float $divisor) //: float
Subject: Let's get those WordCamp sessions on WordPress.tv
Hi ,
Hope you had a great WordCamp and everything went well with your video efforts.
@dd32
dd32 / block-cookies.py
Last active July 21, 2019 03:42
A Trac plugin to block anonymous cookies being sent
"""WordPress.org: Block Anonymous Cookies."""
import re
from trac.core import Component, implements
from trac.web.api import IRequestFilter
from trac.web.session import Session, PURGE_AGE
class WPOrgBlockAnonymousCookies(Component):
"""Prevents Trac from setting cookies for unauthenticated requests.
<h4>WordPress Chat Plugin</h4>
<p>LiveChat – WP live chat plugin for WordPress is a WordPress chat plugin you can use to quickly and easily <strong>add live chat support to your WordPress website</strong>. It allows for instant communication with on-site visitors and customers and enables prompt resolution to their questions or concerns.</p>
<p>With a fully functional WordPress chat plugin, not only <strong>you can increase your sales</strong> - as it’s the quickest way to remove buyer objections – but it also allows you to <strong>build stronger customer relationships</strong>.</p>
<p>https://www.youtube.com/watch?v=dKUdE-JKhZI</p>
<h4>Feature-Rich WordPress Live Chat Plugin</h4>
@dd32
dd32 / fatal-error-handler.php
Last active January 13, 2023 00:52
A quick WordPress 5.1 shutdown handler to disable the plugin/theme pausing features. Install as wp-content/fatal-error-handler.php. This is needed during development, and on sites which have sensitive plugins enabled which must never be deactivated. You should also consider adding a wp-content/php-error.php template. UPDATE: This is replaced by …
<?php
// UPDATE: This can be replaced by `define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true );` in `wp-config.php`.
// See https://core.trac.wordpress.org/changeset/44674
/**
* Shutdown handler to disable WordPress 5.1's plugin/theme pausing features.
*/
class dd32_Fatal_Error_Handler extends WP_Fatal_Error_Handler {
// Do not store errors, this disables the ability for plugins/themes to be marked 'paused'.
<?php
// If you're a host, and you have a plugin installed on every site,
// either of the below hotfixes will allow WordPress 4.9.3 to update to 4.9.4.
// Option 1:
// Fix the dependancies before the fatal is encountered:
add_action( 'set_site_transient_update_core', function( $val ) {
global $wp_version;
if ( wp_doing_cron() && '4.9.3' == $wp_version && !empty( $val->updates ) ) {