Skip to content

Instantly share code, notes, and snippets.

View alexmigf's full-sized avatar

Alexandre Faustino alexmigf

View GitHub Profile
@alexmigf
alexmigf / simba-updater.md
Last active December 21, 2023 10:33
Simba hosting update email notification

I have added 3 more parameters to this hook

do_action( 'updraftmanager_add_new_zip_go', $this->slug, $name, $this->plugin, $addrule, $this->manager_dir.'/'.$name, $comment, $this );

Finally add the code snippet to trigger the email

add_action( 'updraftmanager_add_new_zip_go', function( $slug, $name, $plugin, $addrule, $new_file, $comment, $class ) {
@alexmigf
alexmigf / fix.md
Created April 28, 2023 13:49
Fix Ubuntu 22.04 Bluetooth issues
sudo apt-get install pulseaudio-module-bluetooth
sudo killall pulseaudio
pulseaudio --start    
sudo systemctl restart bluetooth
@alexmigf
alexmigf / valet-linux.md
Last active March 28, 2023 14:47
Fixing "upstream sent too big header while reading response header from upstream" error in Laravel Valet Nginx
  1. Go to ~/.config/valet/Nginx directory and create or edit all.conf file.
  2. Add the following contents to it:
proxy_buffer_size   128k;
proxy_buffers   4 256k;
proxy_busy_buffers_size   256k;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_busy_buffers_size 32k;
@alexmigf
alexmigf / wc.md
Created January 3, 2023 09:40
WooCommerce build
@alexmigf
alexmigf / fnm.md
Created December 15, 2022 22:07
Fast Node Manager (fnm) install on debian/ubuntu
# install fnm
$ curl -fsSL https://fnm.vercel.app/install | bash

# list available versions
$ fnm list-remote

# install version
$ fnm install v19.3.0
$ fnm use v19.3.0
@alexmigf
alexmigf / slw-force-main-product-stock-status-to-instock.php
Last active March 10, 2022 14:21
Force main product status to "instock" even when 0 stock
<?php
add_action( 'slw_product_wc_stock_status', function( $stock, $id ) {
if( ! empty( $id ) ) {
$product = wc_get_product( $id );
if( empty( $product ) ) return;
$parent_id = $product->get_parent_id();
if( $parent_id == 0 ) {
$locations_stock = \SLW\SRC\Helpers\SlwProductHelper::get_product_locations_stock_total( $parent_id );
@alexmigf
alexmigf / slw-export-addon-download-csv-with-sku.php
Created May 25, 2021 22:02
Export products stock locations including the product SKU
<?php
add_filter( 'slw_csv_product_export_data', function( $output, $product ) {
$output[] = $product->get_sku();
return $output;
}, 10, 2 );
add_filter( 'slw_csv_columns', function( $columns, $existing_locations ) {
$columns[0][] = 'sku';
@alexmigf
alexmigf / slw-assign-locations-existing-products.php
Created April 28, 2021 17:35
Assign stock locations to existing products
<?php
add_action( 'admin_init', 'slw_assign_locations_to_products' );
function slw_assign_locations_to_products() {
// add your location IDs below
$location_ids = array( 6, 8 );
// query args
$args = array(
'post_type' => 'product',
################
#!/bin/bash
# Usage: zipsafe
BASENAME="${PWD##*/}"
rm -f $PWD/$BASENAME.zip
cd ../
zip -r $BASENAME.zip ./$BASENAME -x *.git* *.DS_Store *.gitignore *.gitkeep *.gitmodules *.distignore *composer.json
mv ./$BASENAME.zip /home/alex/Downloads/
cd $BASENAME
################
@alexmigf
alexmigf / git_submodules.md
Last active December 24, 2020 11:06 — forked from gitaarik/git_submodules.md
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:

  • You can separate the code into different repositories.