This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
function acf_add_local_field_group($data) { | |
foreach ( $data as $array_key => $array_value ) { | |
if ( is_array($array_value) ) { | |
acf_add_local_field_group( $array_value ); | |
} | |
else { | |
if ( 'key' === $array_key && false === strpos( $array_value, 'layout_' ) ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BEGIN WP Security | |
<IfModule mod_headers.c> | |
#set header for all | |
Header set Content-Security-Policy "default-src 'self' *.googlesyndication.com vimeo.com *.vimeo.com *.vimeocdn.com *.amazonaws.com *.google-analytics.com *.yoast.com yoast.com *.diffuse.tools; connect-src 'self' *.googlesyndication.com google.com *.google.com vimeo.com *.vimeo.com *.linkedin.com *.vimeocdn.com *.amazonaws.com *.google-analytics.com *.yoast.com yoast.com *.diffuse.tools; frame-src 'self' vimeo.com *.vimeo.com *.vimeocdn.com youtube.com *.youtube.com *.googletagmanager.com *.youtube-nocookie.com *.google.com *.doubleclick.net; script-src 'unsafe-inline' 'unsafe-eval' 'self' *.yoast.com yoast.com *.gstatic.com google.com *.google.com googletagmanager.com *.googletagmanager.com *.googleapis.com google-analytics.com *.google-analytics.com *.googlesyndication.com code.diffuse.nl adservice.google.nl adservice.google.com *.googleadservices.com browser-update.org *.facebook.net snap.licdn.com *.doubleclick.net; style-src 'unsafe |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# usage; cron entry to run this script every minute. | |
# the script will take 3 snaps at most, at run, run+20, run+40. Next minute is a new iteration. | |
# script construction allows changes between snaps, as the script runs itself 3x. | |
cd "$(dirname "$0")" | |
# Set default values for environment variables | |
: "${HTTP_URL:=https://webcam.connect.prusa3d.com/c/snapshot}" | |
: "${DELAY_SECONDS:=20}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'password_needs_rehash', 'mu_plugin_mdms_prevent_password_rehashing', 11, 3 ); | |
/** | |
* Maybe prevent password rehashing, limit rehashing to a set-up time-slot. | |
* This filter is only effective in WordPress 6.8 and up, and when not overriding the $wp_hasher global variable. | |
* This is to prevent the password rehashing from happening too often, which WILL cause users forced being logged in every time they switch to a different domain subsite. | |
* | |
* @param bool $needs_rehash Whether the password needs rehashing, defaults to true. | |
* While this could also be false; the way WordPress is set-up, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// mu-plugin or included in theme/plugin | |
add_filter( 'posts_search', 'maybe_search_by_title_only', 10, 2 ); | |
// add query var 'title_only' to the allowed query vars. | |
add_filter( 'query_vars', function ( $vars ) { | |
$vars[] = 'title_only'; | |
return $vars; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Convert a stand-alone WordPress site to a multisite without using the MS Setup. | |
# The Set-Up wizard requires you to deactivate all plugins, but you might not want to do that. | |
# This script helps. | |
# | |
# NOTE: No warranty, use at own risk. Has no checks for existing multisite, it assumes this is a single site installation | |
# This script ASSUMES YOU KNOW WHAT YOU ARE DOING, and so do I. | |
CTM_DB_PREFIX="$1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# example usage: cd ~/Local\ Sites ; find ./*/app/.idea/workspace.xml -exec patch-workspace.sh {} \; | |
[ -z "$1" ] && echo "Usage: $0 filepath-to-workspace.xml" >&2 && exit 1; | |
xmlpath="$1" | |
[ ! -f "$xmlpath" ] && echo File not found: $1 && echo "Usage: $0 filepath-to-workspace.xml" >&2 && exit 2; | |
cp "$xmlpath" "$xmlpath.bak" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This tool is 80% ChatGPT code. Just so you know. | |
error_reporting( -1 ); | |
ini_set('display_errors', 'on'); | |
// === CONFIGURATION === | |
$config = [ | |
'servers' => [ 'srv1.mail.example.com', 'srv2.mail.example.com', ], | |
'timeout' => 10, // seconds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", | |
"palette": { | |
"black": "#262B44", | |
"blue": "#4B95E9", | |
"green": "#59C9A5", | |
"orange": "#F07623", | |
"red": "#D81E5B", | |
"white": "#E0DEF4", | |
"yellow": "#F3AE35" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A script to generate a changelog by comparing composer packages and project commits. | |
# | |
# Disclaimer: | |
# - Using this script is at your own risk. This script only uses READ operations, but I still | |
# do not take any responsibility. | |
# | |
# License: | |
# - BSD 2-Clause — Free to use with attribution. No warranty provided. | |
# |
NewerOlder