Skip to content

Instantly share code, notes, and snippets.

View bradyvercher's full-sized avatar

Brady Vercher bradyvercher

View GitHub Profile
@felixarntz
felixarntz / wp-plugin-mu-loader.php
Last active October 10, 2022 12:21
WP Plugin MU Loader
<?php
/**
* Plugin initialization file
*
* @package WP_Plugin_MU_Loader
* @since 1.0.0
*
* @wordpress-plugin
* Plugin Name: WP Plugin MU Loader
* Plugin URI: https://gist.github.com/felixarntz/daff4006112b60dfea677ca08fc0b31c
@ikennaokpala
ikennaokpala / README.md
Last active March 4, 2024 05:46 — forked from magnetikonline/README.md
Setting Nginx FastCGI response buffer sizes.

Nginx FastCGI response buffer sizes

By default when Nginx starts receiving a response from a FastCGI backend (such as PHP-FPM) it will buffer the response in memory before delivering it to the client. Any response larger than the set buffer size is saved to a temporary file on disk. This process is also explained at the Nginx ngx_http_fastcgi_module page document page.

Since disk is slow and memory is fast the aim is to get as many FastCGI responses passing through memory only. On the flip side we don't want to set an excessively large buffer as they are created and sized on a per request basis (i.e. it's not shared memory).

The related Nginx options are:

@westonruter
westonruter / class-customize-queried-post-info.php
Last active August 2, 2020 07:57
Customize Queried Post Info plugin: Communicate the singular post queried object currently previewed in the Customizer.
<?php
/**
* Customize_Queried_Post_Info class.
*
* @package CustomizeQueriedPostInfo
*/
/**
* Class Customize_Queried_Post_Info.
*/
@afragen
afragen / http-api-debug.php
Created November 21, 2015 01:06
Debug HTTP API calls in WordPress
<?php
add_action( 'http_api_debug', 'viper_http_api_debug', 15, 5 );
function viper_http_api_debug( $response, $type, $class, $args, $url ) {
// You can change this from error_log() to var_dump() but it can break AJAX requests
var_dump( "\n<br />" . 'Request URL: ' . var_export( $url, true ) );
var_dump( "\n<br />" . 'Request Args: ' . var_export( $args, true ) );
var_dump( "\n<br />" . 'Request Response : ' . var_export( $response, true ) );
}
<?php
/**
* Make an internal REST request
*
* @global WP_REST_Server $wp_rest_server ResponseHandler instance (usually WP_REST_Server).
* @param $request_or_method WP_REST_Request|string A WP_REST_Request object or a request method
* @param $path (optional) if the path is not specific in the rest request, specify it here
* @param $data (optional) option data for the request.
* @return WP_Error|mixed
@johnbillion
johnbillion / wp_mail.md
Last active June 3, 2024 13:31
WordPress Emails

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This documentation has moved here: https://github.com/johnbillion/wp_mail

@paulirish
paulirish / what-forces-layout.md
Last active December 24, 2024 07:21
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@devinsays
devinsays / woo-optimizely.php
Created September 11, 2015 21:13
Optimizely Integration with WooCommerce
<?php
// Loads Optimizely and sends revenue information on conversion page.
// Replace Optimizely script with your own ID.
function optimizely_revenue_tracking( $order_id ) {
// Lets grab the order
$order = new WC_Order( $order_id );
$price = $order->get_total();
?>
@GaryJones
GaryJones / gist:56938d30bb86cd1c078a
Last active March 18, 2018 14:02
Config Files list

Config Files

Development-related files that might be found in version-controlled projects. Doesn't include editor-specific files.

Files

  • .editorconfig - EditorConfig define and maintain consistent coding styles between different editors and IDEs.
  • .gitignore - ignore files from version control. Note, don't add system files - contributors should be globally ignoring these on their local machines. Only use for files created during project build, credentials files etc.
@bradt
bradt / url-coupons.js
Last active August 29, 2015 14:17
WooCommerce URL Coupons
$( document ).ready( function() {
var cookie_name = 'dbrains-coupon';
var cookie_name_error = 'dbrains-coupon-error';
if ( 'undefined' === typeof $.cookie( cookie_name ) ) {
return;
}
var message = 'The coupon code ' + $.cookie( cookie_name ).toUpperCase() + ' has been successfully applied.';