Skip to content

Instantly share code, notes, and snippets.

View FrancoStino's full-sized avatar
🌞

Davide Ladisa FrancoStino

🌞
View GitHub Profile
@FrancoStino
FrancoStino / Change Ownership and Permissions for Files in a Directory.md
Last active April 18, 2024 16:31
Using the find command to locate files owned by a specific group and changing ownership and permissions.

Change Ownership and Permissions for Files in a Directory

Preview:
sudo find /path/to/directory -group 100999 -exec chown davide:davide {} \; -exec chmod 775 {} \; ; echo "Operazione completata!"
Associated Context
Type Code Snippet ( .js )
Associated Tags sudo command Directory management Command line interface User interaction File creation Shell scripting Dev tools Data retrieval Error handling Output display
💡 Smart Description Using the find command to locate files owned by a specific group and changing ownership and permissions.This code snippet searches for a directory named "Operazione completata" in the specified group, then copies and chmods it to 775. The executable is executed with an error message indicating that something went wrong.
@FrancoStino
FrancoStino / Expose Localhost to the Internet with ngrok.md
Last active April 9, 2024 10:24
This code snippet sets up an HTTP connection to the localhost port 9000 and returns a string with no timeout.

Expose Localhost to the Internet with ngrok

Preview:
// Start a tool to expose a local server running on a specific port over HTTP
// Note: This code snippet requires ngrok to be installed on the system

ngrok http http://localhost:9000
Associated Context
@FrancoStino
FrancoStino / GoogleShipping Class with Feed Helper and XML - CTX Feed.md
Last active April 11, 2024 19:00
This code snippet defines a class called GoogleShipping that extends the Shipping class. It includes methods for getting shipping information, fetching feed file types and parsing XML data based on certain conditions such as location ID, location group name, minimum handling time, maximum transmission time,

GoogleShipping Class with Feed Helper and XML - CTX Feed

Preview:
<?php

/**
 * Class GoogleShipping
 *
 * @package    CTXFeed
 * @subpackage CTXFeed\V5\Shipping
@FrancoStino
FrancoStino / Recursive Deleting for Files.md
Created March 13, 2024 09:53
The code snippet deletes files one by one, and then updates the index with the current state of the working directory. The '--ignore-unmatch' flag is used to operate quietly (silencing unnecessary output) in case there are no files to remove.

Recursive Deleting for Files

Preview:
# To make the command more performant, we can skip the recursive deletion of files one by one, and instead directly update the index with the current state of the working directory.
# This can be achieved using the following single command:

git rm -r --cached . -q --ignore-unmatch

# The '-q' flag is used to operate quietly (silencing unnecessary output).
# The '--ignore-unmatch' flag prevents an error in case there are no files to remove.
@FrancoStino
FrancoStino / Docker Run Out. Dispatcher AEM.md
Last active March 12, 2024 20:14
This code runs a Docker container on port 4503 8080 and pauses the running process.

Docker Run Out. Dispatcher AEM

Preview:
@echo off
   bin\docker_run out host.docker.internal:4503 8080
   pause
Associated Context
Type Code Snippet ( .js )
@FrancoStino
FrancoStino / Enable long file paths in Git configuration..md
Last active March 7, 2024 08:04
Filename too long in Git for Windows I'm using Git-1.9.0-preview20140217 for Windows. As I know, this release should fix the issue with too long filenames. But not for me. Surely I'm doing something wrong: I did git config core.longpa...

Enable long file paths in Git configuration.

Preview:
git config --system core.longpaths true
Associated Context
Type Code Snippet ( .sh )
Associated Tags windows git git config system longpaths Git configuration System command line Configuration management Command-line interface Version control Software development (SDK) User input github bitbucket version-control mercurial Git Configuration System Level Core Settings Long Paths True Value Version Control File Management Configuration Options System-wide Settings Path Length Limit
📝 Custom Description Filename too long in Git for WindowsI'm using Git-1.9.0-preview20140217 for Windows. As I know, this release should fix the issue with too long filenames. But not for me.Surely I'm doing something w
@FrancoStino
FrancoStino / Disable Payment Gateway for Specific City in WooCommerce.md
Last active March 6, 2024 17:24
This code snippet adds a filter to the 'woocommerce_available_payment_gateways' list. It checks if an admin user is enabled and disables country based on their billing city, then removes the customer's shipping city from that available gateways by setting it in

Disable Payment Gateway for Specific City in WooCommerce

Preview:
// Register a filter hook with a specific function name
add_filter('woocommerce_available_payment_gateways', 'customize_payment_gateway_based_on_criteria', 10, 1);

// Function to customize a payment gateway based on specific conditions
function customize_payment_gateway_based_on_criteria($available_gateways) {
    // Check if in the admin area and return early
    if (is_admin()) {
@FrancoStino
FrancoStino / Aggregating results from multiple promises.md
Last active March 21, 2024 15:08
Takes an array of promises as an input and gets resolved when all the promises get resolved or any of them gets rejected. From The Pieces JavaScript Collection.

Aggregating results from multiple promises

Preview:
Promise.all([ promise_1, promise_2 ]).then((values) => {
    // all input Promises resolved
}).catch((reason) => {
    // one of input Promises rejected
});

| Associated Context | |

@FrancoStino
FrancoStino / functions.php
Created October 10, 2023 21:31 — forked from Zodiac1978/functions.php
Remove events from a specified event category in "The Events Calendar" by Modern Tribe
<?php
/**
* The Events Calendar Remove Events from Month and List Views
*
* @param [object] $query Query of the events page.
* @return [object] Modified Query
*/
function tribe_exclude_events_category_month_list( $query ) {
if ( isset( $query->query_vars['eventDisplay'] ) && ! is_singular( 'tribe_events' ) ) {
@FrancoStino
FrancoStino / hide_plugins_from_the_word_press_admin_plugin_list.php
Last active October 5, 2023 14:44 — forked from shahzaibkhan/functions.php
Hide plugins from the WordPress Admin plugin list
<?php
add_filter(
'all_plugins',
function ( $plugins ) {
$shouldHide = ! array_key_exists( 'show_all', $_GET );
if ( $shouldHide ) {