Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block rmpel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
rmpel /
Last active Jun 5, 2019
Symfony 4 cheatsheet

Symfony 4 cheatsheet


  1. Entity - a thing to store in the database
  2. Repository - handles the entities
  3. Service - A tool or set of tools (like a Mailer or an API Library)
  4. Route - Links a URL to code
  5. Controller - The above code resides herein; routes that belong to eachother like lists for entities and CRUD for those entities are bundled in their own controller.
  6. View - How is the data presented to the user. This can be ANYTHING! HTML, XML, JSON, a File Download etc.
rmpel / gadwp-tweak-muplugin.php
Created Apr 26, 2019
Google Analytics Dashboard for WordPress (GADWP) plugin tweak to put TagManager on top of the HEAD.
View gadwp-tweak-muplugin.php
* You are actually using GADWP in TagManager mode.
* There is no check that TagManager is actively in use, if you disable TagManager,
* change the word 'init' to '_init' :)
rmpel / mu-plugin-cf7-auto-balance-form-html.php
Created Mar 11, 2019
Auto-balance HTML for ContactForm 7
View mu-plugin-cf7-auto-balance-form-html.php
* WHY? Because invalid HTML will break a page, will break visible form feedback.
* Still, WHY? Well, you are right, CF7 should do this all on their own.
add_action( 'wpcf7_save_contact_form', function(WPCF7_ContactForm $contact_form) {
// this is an action, contact_form not given as pointer, so get the pointer from CF7;
$cf = WPCF7_ContactForm::get_current();
rmpel / mu-new-jquery.php
Created Feb 22, 2019
The bestest way to change the jQuery version in WordPress
View mu-new-jquery.php
* Attention all WordPress developers.
* Any plugin that has dependency on jQuery registered like
wp_register_script( 'a-script', .., .., deps: [ 'jquery ' ], ..);
* will now BREAK!!!!
rmpel / after.png
Last active Dec 20, 2018
Cleanup clutter in WordPress 5.x post/page tables
rmpel / wp-499-up-fix-csv-upload.php
Last active Jul 25, 2019
A filter (an mu-plugin) to restore CSV upload functionality to WordPress 4.9.9 and up.
View wp-499-up-fix-csv-upload.php
* Restore CSV upload functionality for WordPress 4.9.9 and up
add_filter('wp_check_filetype_and_ext', function($values, $file, $filename, $mimes) {
if ( extension_loaded( 'fileinfo' ) ) {
// with the php-extension, a CSV file is issues type text/plain so we fix that back to
// text/csv by trusting the file extension.
$finfo = finfo_open( FILEINFO_MIME_TYPE );
$real_mime = finfo_file( $finfo, $file );
rmpel /
Created Oct 17, 2018
Local by Flywheel - DATE SHIT

Create a link to the correct system timezone, in this example 'Europe/Amsterdam'

  1. Open Site SSH
  2. cd /etc
  3. rm localtime
  4. ln -s /usr/share/zoneinfo/Europe/Amsterdam localtime

alter the PHP ini file

  1. Open de PHP config file in /conf/php//php.ini
  2. in the section [Date]
  3. set date.timezone = Europe/Amsterdam
rmpel /
Last active Apr 2, 2019
Local By Flywheel (unofficial) CLI for MacOS
#!/usr/bin/env bash
SQLPRO="$(ls -1d {~,}/Applications/Sequel\ Pro*.app 2>/dev/null | grep Applications | sort | head -n 1)"
while [ "" != "$1" ]; do
rmpel / long-running-query.php
Created Jul 9, 2018
Shellscript + PHP file for automatically ending looped Database query
View long-running-query.php
require 'some-bootstrap.php'; // perhaps wp-load.php
global $db; // perhaps $wpdb
$count = $db->query("DELETE FROM sometable WHERE somefield = 'somevalue' LIMIT 100"); // should return affected rows count
rmpel / get_post_meta_regexp.php
Last active Jul 4, 2018
Get WordPress Post Meta by RegExp, a regular expression variant of get_post_meta
View get_post_meta_regexp.php
* Retrieve post meta field for a post, by Regular Expression match on the key.
* @since 0.0.1
* @param int $post_id Post ID.
* @param string $regexp The regexp to match the meta key against. One capture-group
* allowed for key-ing the results. Full meta_key is used if no
You can’t perform that action at this time.