Skip to content

Instantly share code, notes, and snippets.

View stgoos's full-sized avatar

Steven stgoos

  • The Netherlands
View GitHub Profile
@jordantrizz
jordantrizz / mysql-backup-all-databases.sh
Created November 30, 2022 15:13
Backup all MySQL Databases on a Server
mysql -uroot -N -e 'show databases' | while read dbname; do mysqldump -uroot --complete-insert "$dbname" > "$dbname".sql; done
<?php
/*
Plugin Name: Copy WooCommerce order shipping address to clipboard
Plugin URI: https://www.damiencarbery.com/2022/11/copy-woocommerce-order-shipping-address-to-clipboard/
Description: Copy the shipping (or billing) address, email, phone number, full name or order number to the clipboard for pasting in another application. A WooCommerce Community member asked how to add a button to the order admin page to copy the shipping address to the clipboard. Asked on <a href="https://www.facebook.com/groups/advanced.woocommerce/permalink/6233848903296143/">WooCommerce Community Facebook group</a>.
Author: Damien Carbery
Version: 0.6.20240715
WC tested up to: 9.1.2
Requires Plugins: woocommerce
*/
My notes for upgrading laragon to work with latest apache and php8.1
Update to laragon 5:
- Stop all running services in laragon
- Make sure laragon itself is properly closed
- Download the latest laragon.exe and overwrite your original laragon.exe
https://github.com/leokhoa/laragon/releases/download/5.0.0/laragon.exe
Update to latest apache
- Download the latest apache 2.4 VS16 for windows (Apache 2.4.x OpenSSL 1.1.1 VS16):
@isaumya
isaumya / remove-woocommerce-bloat-marketing-hub.md
Last active March 1, 2025 15:05
Easily Remove WooCommerce Bloated Features like Marketing Hub from WordPress Admin Menu

Remove WooCommerce Bloated Features from WP Admin Menu

Recently WooCommerce has added a lot of improvements to the plugin which we really appriciate but at the same time a lot of bloated features has alos been added to the plugin like Marketing Hub, a completely useless menu taking extra space among the other important menu items. Now if you find Marketing Hub to be useful, you can keep it.

But just in case you are looking for a way to remove these features that you no longer need from your WordPress Admin menus, take a look at the following code snippets. Please note: though I will show you how you can remove the Marketing Hub from your WP Admin menu list completely and make sure WooCommerce doesn't execute codes for that feature you don't need, you can do the same for other WooCommerce features as well like Analytics.

How to remove Marketing Hub for WooCommerce <= v4.2

If you are using WooCommerce <= v4.2, you can simple add this one line of code in your theme's functions.php f

@jlollis
jlollis / reset-pi-passwd.md
Last active January 17, 2025 15:19
Reset Forgotten Raspberry Password

Reset Forgotten Raspberry Pi Password

Remove SD Card

The first step is to turn off the Raspberry so you can remove the memory card without worry.

If the Raspberry Pi is not connected to a screen, the only way to turn it off is to unplug it. Otherwise, you can go through the GUI to turn it off properly, via the menu, before unplugging it.

Once the Raspberry Pi is turned off, you can insert the card into your computer and go to the next step.

@lucasmezencio
lucasmezencio / SLUG.md
Last active March 7, 2025 16:32
Creating URL slugs properly in PHP (including transliteration for UTF-8)

Creating URL slugs properly in PHP (including transliteration for UTF-8)

The point to use a slug (semantic URL) besides of improve the SEO of your articles is to prevent that the user, at the creation of for example an article, it uses special characters that aren't allowed in a URL, appropiate the usage etc. What target usage means, is context dependent.

In this article, you'll learn how to slugify a string in PHP properly, including (or not) support (conversion) for cyrilic and special latin characters.

Slugify in PHP

The following function exposes a simple way to convert text into a valid slug:

@damiencarbery
damiencarbery / multisite-plugins-activated.php
Last active December 9, 2022 13:47
Active Multisite Plugins: List of active plugins on a Multisite installation. https://www.damiencarbery.com/2019/05/active-multisite-plugins/
<?php
/*
Plugin Name: Multisite Plugins Activate
Plugin URI: http://www.damiencarbery.com
Description: List of active plugins on a Multisite installation.
Author: Damien2
*/
// Based on: http://wordpress.stackexchange.com/a/54782/57684
@cr0ybot
cr0ybot / sunrise.php
Last active December 11, 2023 16:27
WordPress Multisite Local/Staging/Live Dev Setup
<?php
/**
* File wp-content/sunrise.php
*
* This allows us to copy the production multisite database to staging/local and still use
* it directly without altering domains
*
* This file can be present on all copies of the site, but it should only be added to the
* wp-config file of local/staging (via `define( 'SUNRISE', true )`)
*
<?php
if(!function_exists('wc_get_products')) {
return;
}
$paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1;
$ordering = WC()->query->get_catalog_ordering_args();
$ordering['orderby'] = array_shift(explode(' ', $ordering['orderby']));
$ordering['orderby'] = stristr($ordering['orderby'], 'price') ? 'meta_value_num' : $ordering['orderby'];
@damiencarbery
damiencarbery / debug.log
Last active December 9, 2022 14:28
Description: Disable selected plugins for specific IP addresses - very useful when debugging plugin clashes: k: https://www.damiencarbery.com/2018/03/disable-selected-plugins-for-specified-ips/
[10-Mar-2018 16:08:01 UTC]
array (
//query-monitor/query-monitor.php,
//hello.php,
);