Skip to content

Instantly share code, notes, and snippets.

View timnolte's full-sized avatar

Tim Nolte timnolte

View GitHub Profile
<?php
// Force re-approval of updated comments.
add_action( 'activitypub_handled_update', function( $activity, $second_param, $state, $reaction ) {
/** @todo: Send an email or something, because if you get quite a few of these, it's impossible to keep up. */
if ( $reaction instanceof \WP_Comment ) {
wp_set_comment_status( $reaction, 'hold' );
wp_notify_moderator( $reaction->comment_ID );
}
}, 99, 4 );
<?php
/**
* Auto-Update Enabler
*
* Decisions, not options. Inspired by Trac ticket #58389 by
* Jos Velasco and an offhanded comment on the fedi by Andy
* Fragen.
*
* @package Auto-Update Enabler
* @author Jason Cosper <boogah@gmail.com>
@nfsarmento
nfsarmento / ns-create-vh-db-wp-ssl.sh
Last active February 23, 2023 00:10
bash script to create mariadb database, create nginx virtual host, setup WordPress and install SSL.
#!/bin/bash
# -------------------------------------------------
# Make site directory
# Download WP and install WP to site directory
# Set WP configuration
# Configure NGINX for new domain-name
# -------------------------------------------------
#
# Requirments:
#
@kingkool68
kingkool68 / use-remote-media.php
Last active March 24, 2024 11:37
Check if a local file exists in the WordPress media library and if it doesn't exist, replace the URL with a different URL. Helpful when working with a local site that doesn't have all of the media downloaded as the production site. See https://localwp.com/community/t/proxying-requests-to-wp-content-uploads-to-a-production-site/15701
<?php
// Put this in wp-config.php and replace https://example.com/ with the URL of the production site.
define( 'RH_USE_REMOTE_MEDIA_URL', 'https://example.com/' );
// Put the rest of this in functions.php or a custom plugin or somewhere else.
if ( defined( 'RH_USE_REMOTE_MEDIA_URL' ) && ! empty( RH_USE_REMOTE_MEDIA_URL ) ) {
add_filter( 'wp_get_attachment_image_src', 'filter_wp_get_attachment_image_src' );
add_filter( 'wp_calculate_image_srcset', 'filter_wp_calculate_image_srcset' );
add_filter( 'wp_get_attachment_url', 'filter_wp_get_attachment_url' );
}
@jmatthewturner
jmatthewturner / graphics.sh
Last active January 15, 2021 04:06
Bash Script for Switching Graphics Modes on System 76 Oryx Pro
#!/bin/bash
# This is a script for switching between Intel and NVIDIA graphics modes
# on System 76 Oryx Pros. It was written because I installed KDE Plasma,
# thereby losing the graphics-switching functionality built into Gnome.
# But it should work just fine under Gnome, as well, if you're into that.
#
# It uses a modified version of Dave Miller's excellent ask.sh script,
# which can be found here:
# https://gist.github.com/davejamesmiller/1965569
@felixarntz
felixarntz / google-site-kit-anonymize-ips.php
Last active August 25, 2021 17:02
WordPress mini plugin as an extension to Site Kit that ensures the inserted Google Analytics snippet anonymizes IP addresses.
<?php
/**
* Site Kit by Google Anonymize IPs plugin file.
*
* @package Google\Site_Kit_Anomyize_IPs
* @author Felix Arntz, Google
* @license GPL-2.0-or-later
* @copyright 2019 Google Inc.
*
* @wordpress-plugin
@andredurao
andredurao / docker-cheat-sheat.md
Created August 6, 2019 19:04 — forked from dwilkie/docker-cheat-sheat.md
Docker Cheat Sheet

Build docker image

$ cd /path/to/Dockerfile
$ sudo docker build .

View running processes

@mdrovdahl
mdrovdahl / _README.md
Last active April 29, 2022 22:58 — forked from jifalops/_README.md
Headless Crostini quick setup script for WordPress development

Headless Crostini quick setup script for WordPress development

WARNING

  • The script appends to the PATH environment variable each time it runs (at the end).

To get the script, use the Terminal app:

user@penguin:~$ mkdir bin && cd $_
user@penguin:~/bin$ curl -O https://gist.githubusercontent.com/mdrovdahl/3e941c129c70d3d0bd1fbc088de1f31b/raw/setup-dev-machine.sh
@gbeezus
gbeezus / install_drupal.sh
Created April 22, 2019 16:55
Drupal Installation Shell Script
#!/bin/bash
drush=/usr/local/bin/drush
#check if drush exists before running rest of script
type $drush >/dev/null 2>&1 || { echo >&2 "I require drush but it's not installed. Aborting."; exit 1; }
#define default variables
profile_d=standard
acctname_d=Admin
@agriffis
agriffis / .vimrc
Created February 25, 2019 12:53
neovim clipboard provider for tmux and OSC 52
function! ClipboardCopy(lines, regtype)
let sum = TryClipboardCmd('md5sum', a:lines)
call writefile(sum, s:regtype_sum, 'S')
call writefile([a:regtype], s:regtype_txt, 'S')
return TryClipboardCmd('clipboard-provider copy', a:lines)
endfunction
function! ClipboardPaste()
let lines = TryClipboardCmd('clipboard-provider paste')
let regtype = 'V'