Skip to content

Instantly share code, notes, and snippets.

View macr1408's full-sized avatar
🏠
Working from home

Marcos macr1408

🏠
Working from home
  • Argentina
View GitHub Profile
@macr1408
macr1408 / plantilla.html
Created July 1, 2023 04:24
Plantilla HTML Factura A afip comprobante
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
@macr1408
macr1408 / plantilla.html
Last active January 22, 2025 22:08
Plantilla HTML Factura afip comprobante
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
@macr1408
macr1408 / mysqlresetpassword.sh
Created June 28, 2020 19:02
Reset Mysql root password
sudo service mysql stop
sudo mkdir /var/run/mysqld
sudo chown mysql:mysql /var/run/mysqld
sudo mysqld_safe --skip-grant-tables --skip-networking &
mysql
UPDATE mysql.user SET authentication_string=PASSWORD('YOURNEWPASSWORD'), plugin='mysql_native_password' WHERE User='root' AND Host='localhost';
exit
@macr1408
macr1408 / sha256.js
Created June 9, 2020 19:11
Javascript encode SHA-256
// Usage
// console.log(Sha256('test'));
function Sha256(s) {
var chrsz = 8;
var hexcase = 0;
function safe_add(x, y) {
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
@macr1408
macr1408 / shipping-class.php
Created March 13, 2018 16:06
Woocommerce - Get shipping area (zone) name in shipping method
$shipping_zone = WC_Shipping_Zones::get_zone_matching_package( $package );
$zone = $shipping_zone->get_zone_name();
if($zone === 'US West'){
//..
}else if($zone === 'US East'){
//...
}else{
//...
}
@macr1408
macr1408 / archive-product.php
Created December 22, 2017 00:59
Woocommerce - Get the category slug (and more) on archive_product
// Get the category ID
$cat_ID = get_queried_object_id();
// Get the category inside an Array
$cat = get_category( $cat_ID, ARRAY_A );
/* Now
$cat = array(
[term_id] => 85
[name] => Category Name
[slug] => category-name
[term_group] => 0