Skip to content

Instantly share code, notes, and snippets.

View nilsringersma's full-sized avatar

Nils Ringersma nilsringersma

View GitHub Profile
@nilsringersma
nilsringersma / my.cnf
Created July 30, 2020 08:43 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaSQL (on Ubuntu, CentOS etc. servers)
# Optimized my.cnf configuration for MySQL/MariaSQL
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated January 2020 ~
#
#
# The settings provided below are a starting point for a 2GB - 4GB RAM server with 2-4 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@nilsringersma
nilsringersma / wp-query-ref.php
Created February 19, 2019 13:16 — forked from luetkemj/wp-query-ref.php
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
function custom_query_shortcode($atts) {
// EXAMPLE USAGE:
// [loop the_query="showposts=100&post_type=page&post_parent=453"]
// Defaults
extract(shortcode_atts(array(
"the_query" => ''
), $atts));
@nilsringersma
nilsringersma / vcl-regex-cheat-sheet
Created February 5, 2019 13:11 — forked from dimsemenov/vcl-regex-cheat-sheet
Regular expression cheat sheet for Varnish (.vcl). Examples of vcl regexp. Found here http://kly.no/varnish/regex.txt (by Kristian Lyngstøl)
Regular expression cheat sheet for Varnish
Varnish regular expressions are NOT case sensitive. Varnish uses POSIX
regular expressions, for a complete guide, see: "man 7 regex"
Basic matching:
req.url ~ "searchterm"
True if req.url contains "searchterm" anywhere.
req.url == "searchterm"
@nilsringersma
nilsringersma / ajax-handler.php
Created December 6, 2018 12:08 — forked from Jayfrown/ajax-handler.php
WordPress mu-plugin to filter active plugins for AJAX calls
<?php
/**
* ajax-handler.php
*
* This mu-plugin is loaded before any other plugin code.
* It attempts to recognize some API-ish calls (i.e.
* traditional admin-ajax.php, wc-ajax and hopefully some
* wp-json/wp-api things at a later stadium.
*
@nilsringersma
nilsringersma / woocommerce.vcl
Created April 25, 2018 10:00 — forked from lukecav/woocommerce.vcl
Varnish 4 VCL for WooCommerce Stores. - Beta
/* SET THE HOST AND PORT OF WooCommerce
* *********************************************************/
backend default {
.host = "127.0.0.1";
.port = "8080";
}
# SET THE ALLOWED IP OF PURGE REQUESTS
# ##########################################################
@nilsringersma
nilsringersma / wordpress.vcl
Last active April 25, 2018 10:14 — forked from matthewjackowski/wordpress.vcl
Varnish 4 VCL configuration for WordPress. Also allows purging
# Varnish 4 VCL for Wordpress
# - https
# - admin cookies for wp-admin
# - cache everything
# - custom error html page
# - TODO: Add WooCommerce support
vcl 4.0;
import directors;
import std;