Skip to content

Instantly share code, notes, and snippets.

@pacmanito
pacmanito / flash-animation.css
Created December 10, 2021 14:03 — forked from damiencarbery/flash-animation.css
Edit stock levels in WooCommerce - Add editing capability to the List stock levels in WooCommerce plugin - https://www.damiencarbery.com/2019/10/edit-stock-levels-in-woocommerce
table.wp-list-table tr.updated { animation: highlight 3s ease 2; }
@keyframes highlight {
0% { background-color: inherit; }
50% { background-color: #d1fa88; }
100% { background-color: inherit; }
}
@pacmanito
pacmanito / sold_goods_report_2.php
Last active April 26, 2020 21:11
Calculate sold goods in multi-dimensional array with recursive function
<?php
$a = array('product name' => 'gasoline', 'quantity' => 2);
$b = array('product name' => 'oil', 'quantity' => 3);
$order1 = array($a,$b);
$c = array('product name' => 'bottle', 'quantity' => 2);
$d = array('product name' => 'gasoline', 'quantity' => 3);
$e = array('product name' => 'lighter', 'quantity' => 1);
$order2 = array($c,$d,$e);
$f = array('quantity' => 13, 'product name' => 'mask');
$g = array('product name' => 'oil', 'quantity' => 7);
@pacmanito
pacmanito / array_iterator.php
Created April 26, 2020 07:52
Multi-dimensional array iterator
$data = array(/* multi-dimensional */);
$result = iterate($data);
function iterate(array $array)
{
$result = array();
foreach($array as $item) {
if(is_array($item)) {
$result[] = iterate($item);
@pacmanito
pacmanito / sold_goods_report.php
Last active April 26, 2020 21:12
Calculate sold goods in multi-dimensional array
<?php
echo "\n" . '-=-=-=-=-=BEFORE LOOP-=-=-=-=-=-=' . "\n". "\n";
$a = array('product name' => 'gasoline', 'quantity' => 2);
$b = array('product name' => 'oil', 'quantity' => 3);
$order1 = array($a,$b);
$c = array('product name' => 'bottle', 'quantity' => 2);
$d = array('product name' => 'gasoline', 'quantity' => 3);
$e = array('product name' => 'lighter', 'quantity' => 1);
$order2 = array($c,$d,$e);
$f = array('quantity' => 13, 'product name' => 'mask');
@pacmanito
pacmanito / functions.php
Last active October 27, 2021 04:47 — forked from kloon/functions.php
WooCommerce - Add send customer order notes email option
<?php
/**
* This adds an option to send order notes email manually via order actions drop-down.
*/
/**
* Filter to add a new menu to the dropdown
*
* @param array $actions
* @return array