Skip to content

Instantly share code, notes, and snippets.

View JoeSz's full-sized avatar

Joe JoeSz

View GitHub Profile
@keilmillerjr
keilmillerjr / clone_root_disk.md
Last active February 19, 2024 14:34
Cloning a Root Disk (Linux)

Cloning a Root Disk (Linux)

Preface

You need to create a bootable live disk to clone your disk. You can not copy a partition that is mounted. If you do not have internet access, use gparted. Otherwise, it might be better to use your operating systems live installer, such as Manjaro. We can download gparted and still have things like a web browser incase we get stuck. We will be using the Manjaro live disk for this guide.

Create a bootable live disk

  1. Download Manjaro.
  2. Insert USB disk.
@damiencarbery
damiencarbery / cf7-redirect-after-submission.php
Last active July 1, 2020 11:10
Contact Form 7 - Redirect after submission - Redirect user to new page after successful submission of a Contact Form 7 form. http://www.damiencarbery.com/2020/06/contact-form-7-redirect-after-submission/
<?php
/*
Plugin Name: Contact Form 7 - Redirect after submission
Plugin URI: http://www.damiencarbery.com/2020/06/contact-form-7-redirect-after-submission/
Description: Redirect user to new page after successful submission of a Contact Form 7 form.
Author: Damien Carbery
Version: 0.1
*/
<?php
/*
Plugin Name: Weekly email
Plugin URI: http://www.damiencarbery.com
Description: Project status weekly automated email.
Author: Damien Carbery
Version: 0.1
*/
@damiencarbery
damiencarbery / add-gift-wrap-option-to-woocommerce-cart.php
Last active February 13, 2023 09:54
Add option for add-on item to WooCommerce cart - A simple way to allow customers add gift wrap or other small add-on to their order. https://www.damiencarbery.com/2020/06/add-option-for-add-on-item-to-woocommerce-cart/
<?php
/*
Plugin Name: Add option for add-on item to WooCommerce cart
Plugin URI: https://www.damiencarbery.com/2020/06/add-option-for-add-on-item-to-woocommerce-cart/
Description: A simple way to allow customers add gift wrap or other small add-on to their order.
Author: Damien Carbery
Version: 0.3
*/
@damiencarbery
damiencarbery / wc-tab-to-edit-product.php
Created May 23, 2020 11:20
Add custom tab to Product Data area of Edit Product page - Add a custom field to Edit Product page. Add a custom tab to organise it. https://www.damiencarbery.com/2020/05/add-custom-tab-to-product-data-area-of-edit-product-page/
<?php
/*
Plugin Name: Add custom tab to Product Data area of Edit Product page
Plugin URI: https://www.damiencarbery.com/2020/05/add-custom-tab-to-product-data-area-of-edit-product-page/
Description: Add a custom field to Edit Product page. Add a custom tab to organise it.
Author: Damien Carbery
Version: 0.1
*/
@damiencarbery
damiencarbery / remove-add-to-cart-conditionally.php
Last active February 4, 2022 11:48
Remove 'Add to cart' conditionally - Conditionally remove the 'Add to cart' button in WooCommerce. https://www.damiencarbery.com/2020/03/remove-add-to-cart-conditionally/
<?php
/*
Plugin Name: Remove 'Add to cart' conditionally
Plugin URI: https://www.damiencarbery.com/2020/03/remove-add-to-cart-button-conditionally/
Description: Conditionally remove the 'Add to cart' button in WooCommerce.
Author: Damien Carbery
Version: 0.4
WC tested up to: 5.1.0
*/
<?php
/*
Plugin Name: Debug WP Job Manager template files
Plugin URI: https://www.damiencarbery.com
Description: Try to debug why WP Job Manager is not finding the template file. From Advanced WordPress Facebook group.
Author: Damien Carbery
Version: 0.1
*/
add_filter( 'job_manager_locate_template', 'dcwd_job_manager_locate_template', 10, 3 );
@damiencarbery
damiencarbery / add-an-post-tracking-provider.php
Last active April 14, 2024 11:12
Tracking Info to WooCommerce order - Use CMB2 to add a custom metabox to add tracking information to WooCommerce orders. The information is then added to the "Completed Order" email. https://www.damiencarbery.com/2020/01/add-tracking-info-to-woocommerce-order/
<?php
/*
Plugin Name: Add Tracking Provider
Plugin URI: https://www.damiencarbery.com/
Description: Add new An Post (Irish postal service) as a tracking provider.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.1.20240414
*/
@sarthology
sarthology / regexCheatsheet.js
Created January 10, 2019 07:54
A regex cheatsheet 👩🏻‍💻 (by Catherine)
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"
@matzeeable
matzeeable / is_rest.php
Last active February 22, 2024 20:20
Checks if the current request is a WP REST API request.
<?php
if ( !function_exists( 'is_rest' ) ) {
/**
* Checks if the current request is a WP REST API request.
*
* Case #1: After WP_REST_Request initialisation
* Case #2: Support "plain" permalink settings and check if `rest_route` starts with `/`
* Case #3: It can happen that WP_Rewrite is not yet initialized,
* so do this (wp-settings.php)