- A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
- lengths are in any unit (ex: pixels)
- code snippets are in JavaScript
angleRad = angleDeg * Math.PI / 180;
litecanvas() | |
function init () { | |
loadScript('https://unpkg.com/@litecanvas/plugin-more-shapes/dist/dist.js', (res) => { | |
if (res) plugin(pluginMoreShapes) | |
}) | |
size = 100 | |
x = WIDTH/2 - size/2 | |
y = HEIGHT/2 - size/2 |
litecanvas(); | |
const max = 3 | |
const dist = 360 / max | |
function init () { | |
x = CENTERX | |
y = CENTERY | |
a = 0 | |
} |
<?php | |
/** | |
* @param bool $is_valid | |
* @param \WC_Coupon $coupon Coupon data. | |
* @return bool | |
*/ | |
add_filter( 'woocommerce_coupon_is_valid', function ( $is_valid, $coupon ) { | |
if ( ! $is_valid ) return false; |
<?php | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; // Exit if accessed directly. | |
} | |
// Hooks | |
add_action( 'plugins_loaded', 'yourprefix_include_shipping_method' ); | |
add_action( 'woocommerce_shipping_methods', 'yourprefix_register_shipping_method' ); |
async function tweenYoyo (from, to, dur, setValue, easeFunc = null, repeat = Infinity) { | |
while(repeat > 0) { | |
await tween( | |
from, | |
to, | |
dur, | |
setValue, | |
easeFunc | |
); | |
await tween( |
kaboom(); | |
// debug.inspect = true | |
loadBean(); | |
const player = add([ | |
sprite('bean'), | |
pos(center()), | |
area(), |
<?php | |
/** | |
* Based on https://www.businessbloomer.com/woocommerce-sale-category-automatic/ | |
*/ | |
add_action( 'pre_get_posts', 'luizpb_wc_sale_category' ); | |
function luizpb_wc_sale_category ( $query ) { | |
$term_slug = 'sale'; | |
if ( $query->get( 'product_cat' ) !== $term_slug ) return; | |
$query->set( 'product_cat', null ); |