Malin / get-table-size.sql
0 likes
0 forks
1 files
Last active
| 1 | // for TFB Database Business Central |
| 2 | |
| 3 | SELECT |
| 4 | t.NAME AS TableName, |
| 5 | s.Name AS SchemaName, |
| 6 | p.rows AS RowCounts, |
| 7 | SUM(a.total_pages) * 8 AS TotalSpaceKB, |
| 8 | SUM(a.used_pages) * 8 AS UsedSpaceKB, |
| 9 | (SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB, |
| 10 | CAST(SUM(a.total_pages) * 8 / 1024.0 / 1024.0 AS DECIMAL(18, 2)) AS TotalSpaceGB, |
Malin / gist:a0ec7c24c45f4ee5bf966e25109abac0
0 likes
0 forks
1 files
Last active
| 1 | // for easycut.es |
| 2 | |
| 3 | add_action('woocommerce_after_checkout_validation', 'restrict_shipping_counties_in_spain', 10, 2); |
| 4 | |
| 5 | function restrict_shipping_counties_in_spain($data, $errors) { |
| 6 | // List of restricted counties |
| 7 | $restricted_counties = array('CE', 'ML', 'GC', 'TF'); |
| 8 | |
| 9 | // Get the shipping country and state from the checkout data |
| 10 | $shipping_country = isset($data['shipping_country']) ? $data['shipping_country'] : ''; |
Malin / page-logout-confirmation.php
0 likes
0 forks
1 files
Last active
| 1 | <?php |
| 2 | /* |
| 3 | Template Name: Confirmación de Cierre de Sesión |
| 4 | */ |
| 5 | |
| 6 | // for QRh |
| 7 | |
| 8 | if (!is_user_logged_in()) { |
| 9 | wp_redirect(home_url()); |
| 10 | exit; |
Malin / orders-in-admin-bar.php
0 likes
0 forks
1 files
Last active
| 1 | // for QRh |
| 2 | |
| 3 | function add_order_counts_to_admin_bar( $wp_admin_bar ) { |
| 4 | if ( ! current_user_can( 'manage_woocommerce' ) ) { |
| 5 | return; |
| 6 | } |
| 7 | |
| 8 | // Query total orders |
| 9 | $args_total = array( |
| 10 | 'limit' => -1, |
Malin / empty-mini-cart-button.php
0 likes
0 forks
1 files
Last active
| 1 | // for QRh |
| 2 | |
| 3 | function add_empty_cart_message_sitewide() { |
| 4 | // Check if WooCommerce is active before proceeding |
| 5 | if ( class_exists('WooCommerce') ) { |
| 6 | ?> |
| 7 | <script type="text/javascript"> |
| 8 | jQuery(document).ready(function($) { |
| 9 | var cartContainer = $('.elementor-menu-cart__main'); // Ensure this targets your specific menu cart container |
Malin / gist:7126af35be67495bb234d4b20e5219e4
0 likes
0 forks
1 files
Last active
| 1 | #!/bin/bash |
| 2 | # Removes the "You do not have a valid subscription for this server" popup message while logging in |
| 3 | # https://johnscs.com/remove-proxmox51-subscription-notice/ |
| 4 | # https://github.com/jmclaren7/proxmox/blob/main/disable-subscription-notice.sh |
| 5 | # https://www.reddit.com/r/Proxmox/comments/1cdmoq9/i_wont_pay_for_proxmox/ |
| 6 | # Manual steps: |
| 7 | # cd /usr/share/javascript/proxmox-widget-toolkit |
| 8 | # cp proxmoxlib.js proxmoxlib.js.bak |
| 9 | # nano proxmoxlib.js |
| 10 | # search for "function(orig_cmd) {" and add "orig_cmd();" and "return;" just after it |
Malin / redirect-add-to-cart.php
0 likes
0 forks
1 files
Last active
| 1 | // for easycut.es |
| 2 | |
| 3 | function custom_redirect_to_cart_after_add_to_cart() { |
| 4 | return wc_get_cart_url(); // Gets the URL of the cart page and redirects to it |
| 5 | } |
| 6 | add_filter('woocommerce_add_to_cart_redirect', 'custom_redirect_to_cart_after_add_to_cart'); |
Malin / enable-product-search-Divi.php
0 likes
0 forks
1 files
Last active
| 1 | // from: https://help.elegantthemes.com/en/articles/3030197-how-to-enable-products-and-other-post-types-in-divi-s-search-module |
| 2 | // for easycut.es |
| 3 | |
| 4 | function custom_remove_default_et_pb_custom_search() { |
| 5 | remove_action( 'pre_get_posts', 'et_pb_custom_search' ); |
| 6 | add_action( 'pre_get_posts', 'custom_et_pb_custom_search' ); |
| 7 | } |
| 8 | add_action( 'wp_loaded', 'custom_remove_default_et_pb_custom_search' ); |
| 9 | |
| 10 | function custom_et_pb_custom_search( $query = false ) { |
Malin / cors-support.conf
0 likes
0 forks
1 files
Last active
| 1 | set $cors ''; |
| 2 | if ($http_origin ~ '^https?://(localhost|www\.qrh\.app|www\.qrh\.hair|qrh\.app|qrh\.hair|stats\.wp\.com|sis-t\.redsys\.es|secure\.gravatar\.com)') { |
| 3 | set $cors 'true'; |
| 4 | } |
| 5 | |
| 6 | if ($cors = 'true') { |
| 7 | add_header 'Access-Control-Allow-Origin' "$http_origin" always; |
| 8 | add_header 'Access-Control-Allow-Credentials' 'true' always; |
| 9 | add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always; |
| 10 | add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always; |