Skip to content

Instantly share code, notes, and snippets.

View FrancoStino's full-sized avatar
🌞

Davide Ladisa FrancoStino

🌞
View GitHub Profile
@FrancoStino
FrancoStino / JetBrains trial reset.md
Created November 13, 2024 16:57 — forked from h3ssan/JetBrains trial reset.md
Reset all JetBrains products trial in Linux

In some cases, only these lines will work

for product in IntelliJIdea WebStorm DataGrip PhpStorm CLion PyCharm GoLand RubyMine; do
    rm -rf ~/.config/$product*/eval 2> /dev/null
    rm -rf ~/.config/JetBrains/$product*/eval 2> /dev/null
done

But if not, try these

@FrancoStino
FrancoStino / Add InCI Meta Box to Post.md
Created November 7, 2024 16:26
This code snippet adds an INCI meta box to a post. It retrieves the product and content, sets up settings for this document URL using Tinymce's editor class with specific parameters such as quicktags, textarea rows, media buttons, and wp_editor functions

Add InCI Meta Box to Post

Preview:
public function add_INCI_meta_box( $post )
    {
        $product  = wc_get_product( $post->ID );
        $content  = $product->get_meta( '_INCI_specs' );
        $settings = array(
            'tinymce'       => array(
                'setup' => 'function (ed) {
@FrancoStino
FrancoStino / Remove the branch locally and in the remote repository in one operation.md
Created September 2, 2024 09:39
This code snippet updates the "nome-branch" branch in a Git repository and deletes it from its origin.

Remove the branch locally and in the remote repository in one operation

Preview:
git branch -D nome-branch && git push origin --delete nome-branch
Associated Context
Type Code Snippet ( .sh )
Associated Tags Git branching Git push origin Nome-branch management Command line interface Node js frameworks Version control Data processing Remote repository creation Repository deletion
💡 Smart Description This code snippet updates the "nome-branch" branch in a Git repository and deletes it from its origin.
@FrancoStino
FrancoStino / Calculate Volumetric Weight Shipping - Woocommerce.md
Created August 14, 2024 09:39
A PHP function to calculate and set volumetric weight for shipping packages in WooCommerce based on product dimensions.

Calculate Volumetric Weight Shipping - Woocommerce

Preview:
<?php 

add_filter('woocommerce_cart_shipping_packages', 'calculate_volumetric_weight_shipping');

function calculate_volumetric_weight_shipping($packages) {
    $conversion_factor = 200; // Il fattore di conversione: 200 kg per m³
   
@FrancoStino
FrancoStino / git-export.md
Created July 29, 2024 14:19 — forked from vanquang9387/git-export.md
git: export diff files between 2 branches/commits

We can get list of changed files between 2 branches/commits by

$ tar --ignore-failed-read -vczf archive.tgz $(git diff --name-only --diff-filter=ACMRT master develop)

Let's see important part:

  1. git diff master develop:
    Get differences between master and develop branches.
@FrancoStino
FrancoStino / Create symbolic links to custom plugins.md
Created July 11, 2024 09:22
Create symbolic links to custom plugins in the current directory from a specified location.
@FrancoStino
FrancoStino / Ollama and Open-WebUI Services.md
Created July 4, 2024 12:24
This code snippet is a configuration file that sets up services for an Ollama application. It specifies the image, container name, ports, volumes, and restarts when running or not. The open-webui service uses Docker API to create

Ollama and Open-WebUI Services

Preview:
version: '3.8'

services:
  ollama:
    image: ollama/ollama
    container_name: ollama
 ports:

Webpack device server configuration - AEM

Preview:
"start": "webpack-dev-server --open --config ./webpack.dev.js --env writeToDisk",
Associated Context
Type Code Snippet ( .json )
Associated Tags package.json GitHub: sidea2 webpack-dev-server open command config file writeToDisk function web development server configuration environment variable
Associated Commit Messages go
@FrancoStino
FrancoStino / Sync ACF Fields on WP_CLI Commands.md
Last active June 7, 2024 18:35
Check if WP_CLI is defined and if the ACF_Commands class does not already exist, then synchronize ACF fields.

Sync ACF Fields on WP_CLI Commands

Preview:
// Controlla se WP_CLI è definito e se non esiste già la classe ACF_Commands
if ( defined( 'WP_CLI' ) && WP_CLI && ! class_exists( 'ACF_Commands' ) ) :

    /**
     * Classe ACF_Commands
     */
    class ACF_Commands extends WP_CLI_Command {
@FrancoStino
FrancoStino / Sync ACF Fields on Admin Init.md
Last active June 12, 2024 08:11
This code snippet adds an action to the admin_init hook. It retrieves field groups, finds JSON field groups which have not yet been imported, and then imports fields from a group based on their local or private values in it. The sync array is also

Sync ACF Fields on Admin Init

Preview:
/**
 * Synchronizes ACF field groups from JSON files.
 *
 * This function is hooked to the `admin_init` action and is responsible for
 * finding and importing any ACF field groups that have been defined in JSON
 * files but have not yet been imported into the database.
 *