Skip to content

Instantly share code, notes, and snippets.

View keesiemeijer's full-sized avatar

Kees Meijer keesiemeijer

View GitHub Profile
@keesiemeijer
keesiemeijer / setup-phpunit.sh
Last active December 8, 2023 11:02
Setup PHPUnit for use in the Local by Flywheel app
#!/usr/bin/env bash
# ===============================================================================
# Script to install PHPUnit in the Local by Flywheel Mac app
# These packages are installed
#
# PHPUnit, curl wget, rsync, git, subversion and composer.
#
# WordPress is installed in the `/tmp/wordpress` directory for use by PHPUnit.
# The WordPress test suite is installed in the `/tmp/wordpress-tests-lib` directory.
@keesiemeijer
keesiemeijer / wp-update
Last active November 17, 2023 07:08
A bash script to update everything WordPress (core, plugins, themes and comments).
#!/usr/bin/env bash
# =============================================================================
#
# *** WARNING: THIS SCRIPT IS NO LONGER MAINTAINED ***
#
# use https://github.com/keesiemeijer/wp-update instead
#
# =============================================================================
@keesiemeijer
keesiemeijer / youtube-remove-ads.js
Last active October 19, 2022 20:57
Youtube skip ads and remove overlay ads after 3 seconds
// ==UserScript==
// @name Youtube SkipAd
// @namespace keesiemeijer
// @version 0.1
// @description Automatically skips ads after 5 seconds
// @author keesiemeijer
// @match https://www.youtube.com/*
// @grant none
// ==/UserScript==
@keesiemeijer
keesiemeijer / functions.php
Created September 18, 2016 18:12
Insert HTML between paragraphs in WordPress post content
<?php
/**
* Insert HTML between paragraphs in WordPress post content using php DOMDocument().
*
* Inserts HTML in the middle of top level paragraphs.
* For example:
*
* <p>Hello</p>
* <blockquote>
* <p>Awesome</p><!-- not a top level paragraph -->
@keesiemeijer
keesiemeijer / gist:7563447
Last active March 18, 2021 08:28
Gets date ranges for the BETWEEN operator in a WordPress meta query
<?php
/**
* Gets date ranges for the BETWEEN operator in a WordPress meta query.
* WordPress minimum requirements don't let you
* use php DateTime or (some) relative formats for strtotime() which were introduced in php 5.3.
*
* @param string|array $args Arguments.
* @return array Array with two dates.
*/
function get_between_clause_dates( $args ) {
@keesiemeijer
keesiemeijer / wp-topic-redirect.user.js
Last active January 20, 2020 07:06
A Greasemonkey user script that forces https, adds view=all to topic urls and redirects if needed
// ==UserScript==
// @name WordPress topic redirect
// @namespace WordPress_topic_redirect
// @description Forces https, adds view=all to topic urls and redirects if needed in the WordPress support forums.
// @version 1
// @grant none
// @run-at document-start
// @include *://*wordpress.org/support/topic/*
// @include *://wordpress.org/support/users/*
// @include *://wordpress.org/support/theme/*
// ==UserScript==
// @name Imbd SkipAd
// @namespace Imbdskipad
// @version 0.1
// @description Remove IMBD header ad
// @author keesiemeijer
// @match https://www.imdb.com/*
// @grant none
// ==/UserScript==
@keesiemeijer
keesiemeijer / wp-word-frequency.txt
Last active March 20, 2018 16:29
WordPress functions and hooks word frequency
1118 wp
714 get
389 post
242 comment
217 link
190 user
158 update
156 the
141 meta
139 admin
@keesiemeijer
keesiemeijer / gist:3cfbdd39f09ba30aff915287d67af6e7
Last active March 20, 2018 15:42
WordPress function word frequency
869 wp
559 get
225 post
124 link
113 is
106 comment
99 update
99 add
97 the
89 ajax
@keesiemeijer
keesiemeijer / shortcode-regex-finder.php
Last active January 17, 2018 19:45
Shortcode Regex Finder
<?php
/**
* Plugin Name: Shortcode Regex Finder
* Plugin URI:
* Description: This plugin creates the regex WordPress would use to find a specific shortcode in content.
* Author: keesiemijer
* License: GPL v2
* Version: 1.0
* Text Domain: shortcode-regex-finder
*/