Skip to content

Instantly share code, notes, and snippets.

View mindctrl's full-sized avatar

John Parris mindctrl

View GitHub Profile
@KZeni
KZeni / freemius-killer.php
Last active August 15, 2024 15:02 — forked from thefrosty/freemius.php
Freemius Killer: A WordPress plugin that keeps your site lightweight by preventing the Freemius middleware from ever coming into play. Best when running Freemius' own "Freemius Fixer" plugin while this is enabled to purge existing Freemius data while this keeps it away. *NOTE:* This plugin manually specifies the plugins that use Freemius to then…
<?php
// REQUIRED: Make sure to edit the last few lines to assign the global variable that any particular Freemius/FS-enabled plugin wants to use to have this intercept it (if not already included below.)
// Please, any revisions for **adding more plugin to be supported by default** and/or better accommodating things are welcome at: https://gist.github.com/KZeni/7afbd8b9a94c23aa0a9133d4ce767d0b
// One would like to think this could grow to automatically intercept all plugins trying to use Freemius, but manual editing & updating a gist (maybe eventually getting to the point of being a plugin with automatic updates [be it via a WP.org plugin listing, its own built-in updater like PUM, GitHub repo where sites have plugins check a repo for new releases, etc.])
// Based on: https://gist.github.com/thefrosty/d9bb001c05a407ba1aaa60c8b75aeb43 (via https://austin.passy.co/2024/disable-freemius-in-wordpress-plugins/)
declare(strict_types=1);
/**
* Create an override function, as to bypass Freemius in plugins that in
import ReactDOM from "react-dom";
import {
BlockEditorProvider,
BlockList,
WritingFlow,
ObserveTyping,
BlockEditorKeyboardShortcuts,
storeConfig as blockEditorStoreConfig,
BlockInspector,
@nickcernis
nickcernis / docker-cleanup.md
Last active August 5, 2024 12:34
Docker commands to remove all containers and images

docker kill $(docker ps -q) to kill all running containers
docker rm $(docker ps -a -q) to delete all stopped containers.
docker volume rm $(docker volume ls -q) to delete all volumes.
docker rmi $(docker images -q) to delete all images.

Run all commands:

docker kill $(docker ps -q) && docker rm $(docker ps -a -q) && docker volume rm $(docker volume ls -q) && docker rmi $(docker images -q)

For fish shell, remove the $:

@mintplugins
mintplugins / Send email of files changed on server once per day
Last active November 2, 2019 15:27
Put this code in a shell file called "email-if-files-changed" somewhere on your server. Then link to it from a cronjob in your crontab file using this line: 01 1 * * * root /path-to-your-custom-script/email-if-files-changed
#!/bin/bash
FILES_CHANGED=$(find /var/www -type f -mmin -$((60*24)) -printf '%TY-%Tm-%Td %TT %p\n' | sort -r)
if [ !$FILES_CHANGED ]
then
curl -s --user 'api:MAILGUN_API_KEY' \
https://api.mailgun.net/v3/YOURMAILGUNDOMAIN/messages \
-F from='Name of your server<support@yourdomain.com>' \
-F to=support@yourdomain.com \
function get_my_plugin_data(){
// You'll likely replace this with some sort of API call home.
$plugin = json_decode(
json_encode(
array(
'new_version' => 89,
'stable_version' => 89,
'name' => 'My Fake Plugin',
'slug' => 'my-fake-plugin',
'url' => 'https://myfakeplugin.com',
@sarthology
sarthology / regexCheatsheet.js
Created January 10, 2019 07:54
A regex cheatsheet 👩🏻‍💻 (by Catherine)
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"
@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

@ericandrewlewis
ericandrewlewis / gist:95239573dc97c0e86714
Last active September 11, 2024 17:10
Setting up a WordPress site on AWS

Setting up a WordPress site on AWS

This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

This tutorial assumes you're relatively comfortable on the command line and editing system configuration files. It is intended for folks who want a high-level of control and understanding of their infrastructure. It will take about half an hour if you don't Google away at some point.

If you experience any difficulties or have any feedback, leave a comment. 🐬

Coming soon: I'll write another tutorial on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.

@johnbillion
johnbillion / hierarchy.php
Last active June 22, 2023 23:05
ASCII WordPress Template Hierarchy
<?php
/*
WordPress Theme Template Hierarchy Last updated for WordPress 5.4
==================================
This diagram is partially simplified for legibility. To view the complete template hierarchy in use on your site see the
Template panel in the Query Monitor plugin.
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)