Skip to content

Instantly share code, notes, and snippets.

View cdsaenz's full-sized avatar

charly cdsaenz

View GitHub Profile
@cdsaenz
cdsaenz / class-wc-kia-class-email.php
Created May 11, 2022 19:37 — forked from helgatheviking/class-wc-kia-class-email.php
Send a WooCommerce Customer email from the Order Admin Actions
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! class_exists( 'WC_KIA_Class_Email', false ) ) :
/**
* A custom Order WooCommerce Email class
*
* @since 0.1
* @extends \WC_Email
@cdsaenz
cdsaenz / searchreplaceregexbrackets.md
Created June 4, 2022 16:44
VSCode replace $row["field_name"] with $row->field_name

Background

Search and Replace in VSCode, change PHP array for object.

Previously

Activate Use Regular Expression

Instructions

SEARCH:
($row)["(.+?)"]

@cdsaenz
cdsaenz / locro.md
Last active July 9, 2022 20:26
Argentina Locro Recipe

ARGENTINA LOCRO CLASSIC DISH Recipe

A link to help on the language (it's got lots of errors in the actual preparation and ingredients!) http://www.saveur.com/article/Recipes/Classic-Locro-Hominy-Stew

LOCRO INGREDIENTS (FOR 10 PEOPLE! ADAPT!!!)

  • 1 KG broken hominy (dried white corn seeds)
  • 1/2 KG white beans (some call it butter beans, or white lima beans: the bigger the better)
  • 1/4 KG bacon (raw bacon, NOT smoked bacon)
  • Pork meat: 4 pig trotters, 1/4 KG pig skin
@cdsaenz
cdsaenz / xss_clean.php
Created August 18, 2022 00:37 — forked from mbijon/xss_clean.php
XSS filtering in PHP (cleans various UTF encodings & nested exploits)
<?php
/*
* XSS filter, recursively handles HTML tags & UTF encoding
* Optionally handles base64 encoding
*
* ***DEPRECATION RECOMMENDED*** Not updated or maintained since 2011
* A MAINTAINED & BETTER ALTERNATIVE => kses
* https://github.com/RichardVasquez/kses/
*
* This was built from numerous sources
@cdsaenz
cdsaenz / index.html
Created August 19, 2022 14:11
Demo Alpine JS and Fetch from Remote API
<!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>Alpine Ajax test</title>
</head>
<body>
<h1>Users API Retrieval Test</h1>
@cdsaenz
cdsaenz / product_create.php
Created September 11, 2022 20:07
Wordpress create product woocommerce
<?php
/**
* Create product
*/
function csdev_new_simple_product()
{
$product = new WC_Product_Simple();
$product->set_name('test 2');
@cdsaenz
cdsaenz / cache.php
Last active September 14, 2022 14:05
Cache Control HTML
<?php
/**
* Source is
* https://stackoverflow.com/a/2068407/827376
*/
/* VIA HTTP */
header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1.
header("Pragma: no-cache"); // HTTP 1.0.
header("Expires: 0"); // Proxies.
@cdsaenz
cdsaenz / my_get_plugin_info.php
Created September 20, 2022 20:05 — forked from butlerblog/my_get_plugin_info.php
#utility to get plugin info
<?php // no need to use this line.
/**
* Utility to get information on installed plugins.
*
* Returns an array of all installed plugins and indicates which are
* plugin are active and which are not. Array is keyed by the plugin's
* folder/slug.php (which is how WP looks at them) and includes the
* name, version, and true/false whether it is active or not.
*
@cdsaenz
cdsaenz / delete_older_than.php
Created September 25, 2022 15:04 — forked from tdebatty/delete_older_than.php
A simple PHP function to delete files older than a given age. Very handy to rotate backup or log files, for example...
<?php
/**
* A simple function that uses mtime to delete files older than a given age (in seconds)
* Very handy to rotate backup or log files, for example...
*
* $dir String whhere the files are
* $max_age Int in seconds
* return String[] the list of deleted files
*/
@cdsaenz
cdsaenz / VSCode-Regex-Search-Replace-Markdown-Images
Created September 29, 2022 18:37 — forked from dixonge/VSCode-Regex-Search-Replace-Markdown-Images
Regex to find markdown images and replace with img tag in VS Code (or template engine shortcode, etc.)
Find: !\[(.*?)\]\((.*?)\)
Replace: <img alt="$1" src="$2">