Skip to content

Instantly share code, notes, and snippets.

View jbrinley's full-sized avatar

Jonathan Brinley jbrinley

View GitHub Profile
@jbrinley
jbrinley / Dockerfile
Last active September 10, 2019 09:48
Install php7 memcached on alpine linux - dockerfile snippet
RUN
apk add --update \
autoconf \
file \
g++ \
gcc \
libc-dev \
make \
pkgconf \
re2c \
# ************************************************************
# Sequel Pro SQL dump
# Version 4541
#
# http://www.sequelpro.com/
# https://github.com/sequelpro/sequelpro
#
# Host: docker (MySQL 5.5.52)
# Database: wordpress
# Generation Time: 2016-09-19 02:06:44 +0000
@jbrinley
jbrinley / install.md
Created August 20, 2016 01:05
Install Docker for Mac

Mac

Prerequisites

  • 2010 or newer Mac
  • OS X 10.10.3 or later
  • Uninstall VirtualBox if you have version 4.3.30 or earlier

Install Docker for Mac

@jbrinley
jbrinley / Dockerfile
Last active August 3, 2016 20:24
PHP7 FPM dockerfile
# Use Alpine Linux
FROM alpine:latest
# Environments
ENV TIMEZONE Etc/UTC
ENV PHP_MEMORY_LIMIT 512M
ENV MAX_UPLOAD 50M
ENV PHP_MAX_FILE_UPLOAD 200
ENV PHP_MAX_POST 100M
@jbrinley
jbrinley / force-plugin-activation.php
Last active November 5, 2020 15:11
An mu-plugin that forces selected plugins to be active, without the capability to deactivate.
<?php
/*
Plugin Name: Force Plugin Activation/Deactivation (except if WP_DEBUG is on)
Plugin URI: http://tri.be/
Description: Make sure the required plugins are always active.
Version: 1.0
Author: Modern Tribe, Inc.
Author URI: http://tri.be/
*/
<?php
add_filter( 'tribe_get_list_widget_events', 'cc_tribe_get_list_widget_events' );
function cc_tribe_get_list_widget_events( $posts ) {
$output_posts = [];
$used_posts = [];
$query = new WP_Query([
'eventDisplay' => 'list',
'posts_per_page' => 3,
@jbrinley
jbrinley / object-cache.php
Created September 24, 2015 16:27
A memcached object cache handler for WordPress, based on https://wordpress.org/plugins/memcached-redux/
<?php
/*
Plugin Name: Memcached Redux
Description: The real Memcached (not Memcache) backend for the WP Object Cache.
Version: 0.2
Plugin URI: http://wordpress.org/extend/plugins/memcached/
Author: Scott Taylor - uses code from Ryan Boren, Denis de Bernardy, Matt Martz
Contributors: jbrinley, Modern Tribe
Install this file to wp-content/object-cache.php
@jbrinley
jbrinley / mail-to-text.php
Created September 20, 2015 19:21
Send all WP emails to text files in the uploads directory
<?php
/*
Plugin Name: Mail to Text
Description: Sends all WP emails to text files in the uploads directory
*/
if ( !function_exists( 'wp_mail' ) ) :
@jbrinley
jbrinley / nginx.conf
Created June 2, 2015 20:49
Partial nginx.conf to show proxy IP forwarding
location / {
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Real-IP $proxy_remote_addr;
proxy_set_header X-Forwarded-For $proxy_remote_addr;
@jbrinley
jbrinley / gist:eaaad00b52e1316c6904
Created February 18, 2015 20:40
WP Trac 17817 Release Notes

WordPress 4.2 introduces a significant reworking of action and filter iteration to address bugs that arose from recursive callbacks and from callbacks that changed the hooked callbacks on currently running actions/filters.

What does this mean for you, the plugin or theme developer? In almost all cases, nothing. Everything should continue to run as expected, and this should fix a number of hard-to-trace bugs when different plugins are stepping on each others callbacks.

Who is affected?

If your plugin directly accesses the $wp_filter global rather than using the public hooks API, you might run into compatibility issues.

Case 1: Directly setting callbacks in the $wp_filter array