Blog

Woocommerce Javascript events

Woocommerce Checkout JS events $( document.body ).trigger( ‘init_checkout’ ); $( document.body ).trigger( ‘payment_method_selected’ ); $( document.body ).trigger( ‘update_checkout’ ); $( document.body ).trigger( ‘updated_checkout’ ); $( document.body ).trigger( ‘checkout_error’ ); $( document.body ).trigger( ‘applied_coupon_in_checkout’ ); $( document.body ).trigger( ‘removed_coupon_in_checkout’ ); Woocommerce cart page JS events $( document.body ).trigger( ‘wc_cart_emptied’ ); $( document.body ).trigger( ‘update_checkout’ ); $( […]

Read more
PHP Functions

Plesk PHP Version Not Matching Command Line

echo “PATH=/opt/plesk/php/7.1/bin:$PATH” >> ~/.bash_profile Replace the version number with the one you have set. Then close out the terminal and reopen.  Run php -v and you should see the correct version.   php -v PHP 7.4.27 (cli) (built: Dec 23 2021 14:48:17) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) […]

Read more

Reset and Reload Fabric Canvas

  var json = canvas.toJSON(); canvas.clear(); canvas.loadFromJSON(json, canvas.renderAll.bind(canvas));  

Read more

Resize Fabric js Canvas

  canvas.setWidth( <desired width> ); canvas.setHeight( <desired height> ); canvas.calcOffset();  

Read more

Order Array By Int, Float, Text Value Javascript

  var arrayVar = [ { name: ‘Bobby’, someValue: 123123 }, { name: ‘Phillip’, someValue: 123 } ]; arrayVar = arrayVar.sort((a, b) => {return a.someValue – b.someValue}); // save the sort result // (a – b) = Ascending sort, (b – a) = Descending sort console.log(arrayVar);

Read more

How To Get Public IP Address from Command line

  curl http://ipecho.net/plain  

Read more

Speech Recognition With Javascript

  var grammar = ‘#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | […]

Read more

Books Without Batteries

Read more

Extract JSON String from Page Element with Javascript

var somePageElement = ‘{ “name”:”John”, “age”:30, “car”:”Tesla” }’; var jsonString = ‘[‘ + somePageElement.split(‘[‘)[1].somePageElement(‘]’)[0] + ‘]’;

Read more

Fix Screen Flickering Issus with Lenovo Yoga 2 in Windows

Turn off Adaptive Brightness in Windows power settings.   Turn off Display Power Saving Technology in Intel HD Graphics dialogue.

Read more