/**
* Creates nested groups by object properties.
* `properties` array nest from highest(index = 0) to lowest level.
*
* @param {String[]} properties
* @returns {Object}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Edit default Woocommerce product loop thumbnail template | |
* As there is no dedicated Woocommerce template (eg wp-content/plugins/woocommerce/templates/loop/price.php) | |
* because it's generated using filter, we must remove Woocommerce hook, and add our own "at the same place" | |
* to edit the product loop thumbnail template | |
* tested up to | |
* 14/07/2023 : | |
* Woocommerce 6.2.2 | |
* 12/10/2020 : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wp post delete $(wp post list --post_type='scheduled-action' --format=ids) | |
wp post delete $(wp post list --post_status=trash --format=ids) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
# dependecies | |
apt update | |
apt install -y git automake build-essential pkg-config libevent-dev libncurses5-dev byacc | |
# where our temp file locates | |
rm -rf /tmp/tmux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Install Redis extension on your pc | |
Download the CORRECT version the DDL from the following link | |
https://pecl.php.net/package/redis/4.1.0/windows | |
Put the dll in the correct folder | |
Wamp -> C:\wamp\bin\php\php-XXXX\ext | |
Laragon -> C:\laragon\bin\php\php-XXX\ext | |
Edit the php.ini file adding |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Sketchapp fro MacOS is a fantastic tool for prototyping, but has some drawbacks that make converting designs to fully functional websites a pain. | |
One of these is sketchapp's line-height, which doesn't seem to have any relation to CSS line-height values. | |
This is a simple example of how we can take a line height value from sketch and apply it to a CSS class for styling text: | |
Lets assume the text in our Sketchapp prototype has a font size of "18px", and line height of "33"... | |
Our CSS class would look like this: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Download Google Drive files with WGET | |
- replace FILEID with your Google Drive FILEID | |
- Google Drive file must have a public shared URL (file share options) | |
- will create a /tmp/cookies.txt to save cookies, and handle Google Drive "Big files" download verification | |
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @param WP_Query|null $wp_query | |
* @param bool $echo | |
* @param array $params | |
* | |
* @return string|null | |
* | |
* UPDATE for Bootstrap 5.0: https://gist.github.com/mtx-z/af85d3abd4c19a84a9713e69956e1507 | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Works with WooCommerce 3.2.6 | |
add_action( 'woocommerce_shipping_init', 'econt_shipping_method' ); | |
function econt_shipping_method() { | |
if ( ! class_exists( 'WC_Econt_Shipping_Method' ) ) { | |
class WC_Econt_Shipping_Method extends WC_Shipping_Method { | |
public function __construct( $instance_id = 0 ) { | |
$this->instance_id = absint( $instance_id ); | |
$this->id = 'econt';//this is the id of our shipping method |
Alternate title: How to Fix FrankenDebian's Monster.
https://wiki.debian.org/DontBreakDebian#Don.27t_make_a_FrankenDebian