Skip to content

Instantly share code, notes, and snippets.

View Preciousomonze's full-sized avatar
🤡
Coding on the bicycle 😎🚴🏽‍♂️

Precious Omonzejele Preciousomonze

🤡
Coding on the bicycle 😎🚴🏽‍♂️
View GitHub Profile
@jagregory
jagregory / gist:710671
Created November 22, 2010 21:01
How to move to a fork after cloning
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear!
Technically, when you fork "origin" should be your fork and "upstream" should be the project you forked; however, if you're willing to break this convention then it's easy.
* Off the top of my head *
1. Fork their repo on Github
2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it
git remote add my-fork [email protected]
@mkolb
mkolb / var_dump-log.php
Last active January 3, 2023 14:53
var_dump into error log
<?php
ob_start();
var_dump($this);
error_log(ob_get_clean());
?>
@DevinWalker
DevinWalker / woocommerce-optimize-scripts.php
Last active November 14, 2024 09:20
Only load WooCommerce scripts on shop pages and checkout + cart
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@strangerstudios
strangerstudios / pmpro-change-level-id.sql
Last active November 10, 2023 18:26
SQL to change the id of a Paid Memberships Pro level from old_id to new_id. Please BACKUP YOUR DATABASE FIRST, make sure to change the DB table names to match your prefix, and make sure that there is not another level with
# change these vars
SET @old_id = 2;
SET @new_id = 1;
# change the db table prefix here
UPDATE IGNORE wp_pmpro_membership_levels SET id = @new_id WHERE id = @old_id;
UPDATE IGNORE wp_pmpro_discount_codes_levels SET level_id = @new_id WHERE level_id = @old_id;
UPDATE IGNORE wp_pmpro_membership_orders SET membership_id = @new_id WHERE membership_id = @old_id;
UPDATE IGNORE wp_pmpro_memberships_categories SET membership_id = @new_id WHERE membership_id = @old_id;
UPDATE IGNORE wp_pmpro_memberships_pages SET membership_id = @new_id WHERE membership_id = @old_id;
@yvele
yvele / get-npm-package-version.sh
Last active April 27, 2024 04:19
Extract version from package.json (NPM) using bash / shell
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g' \
| tr -d '[[:space:]]')
echo $PACKAGE_VERSION
@strangerstudios
strangerstudios / nextlastpayments.php
Last active August 31, 2021 21:21
Add last payment date and next payment date to the members list and export CSV in Paid Memberships Pro (PMPro)
/*
Add last paymenet date and next payment date to the members list and export CSV
Add this code into a custom plugin or your active theme's functions.php.
Note that "last payment" value will get the last order in "success", "cancelled", or "" status.
(Oddly enough, cancelled here means that the membership was cancelled, not the order.)
The "next payment" value is an estimate based on the billing cycle of the subscription and the last order date.
It may be off form the actual recurring date set at the gateway, especially if the subscription was updated at the gateway.
@tripflex
tripflex / functions.php
Last active July 12, 2024 13:20
WordPress Remove Filter (remove_filter converted to remove_class_filter) to remove Filter/Action without Class Object access. Works with WordPress 1.2+ (4.7+ support added 9-19-2016)
<?php
/**
* Make sure the function does not exist before defining it
*/
if( ! function_exists( 'remove_class_filter' ) ){
/**
* Remove Class Filter Without Access to Class Object
*
* In order to use the core WordPress remove_filter() on a filter added with the callback
@knowbody
knowbody / RNfontWeights.js
Created July 14, 2016 13:42
React Native Font Weight Cheatsheet iOS
{ fontWeight: '100' }, // Thin
{ fontWeight: '200' }, // Ultra Light
{ fontWeight: '300' }, // Light
{ fontWeight: '400' }, // Regular
{ fontWeight: '500' }, // Medium
{ fontWeight: '600' }, // Semibold
{ fontWeight: '700' }, // Bold
{ fontWeight: '800' }, // Heavy
{ fontWeight: '900' }, // Black
@sybrew
sybrew / remove-woocommerce-message-part.php
Last active October 15, 2021 05:24
Removes "Continue Shopping" message from WooCommerce after item has been added to cart.
<?php
\add_filter( 'wc_add_to_cart_message', function( $string, $product_id = 0 ) {
$start = strpos( $string, '<a href=' ) ?: 0;
$end = strpos( $string, '</a>', $start ) ?: 0;
return substr( $string, $end ) ?: $string;
} );
@rynaldos-zz
rynaldos-zz / wc-no-links-thumbnails.php
Last active March 20, 2021 02:24
[WooCommerce 3.0+] Remove links from single product image thumbnails