If you have to extend an existing object with additional property, always prefer Vue.set()
over Object.assign()
(or spread operator).
Example below explains implications for different implementations.
/** | |
* Replace contribution titles with the contribution image | |
* | |
* NOTE: requires version higher than 1.6.3 to use this filter | |
* | |
* @param string $title the contribution title | |
* @param \WC_Contribution $contribution the contribution object with comment data | |
* @return string - updated title | |
*/ | |
function sv_wc_prp_replace_widget_contribution_title( $title, $contribution ) { |
class DOMAnimations { | |
/** | |
* Masque un élément avec un effet de repli | |
* @param {HTMLElement} element | |
* @param {Number} duration | |
* @returns {Promise<boolean>} | |
*/ | |
static slideUp (element, duration = 500) { | |
return new Promise(function (resolve, reject) { | |
element.style.height = element.offsetHeight + 'px' |
**/*.min.js | |
**/*.build.js | |
**/node_modules/** | |
**/vendor/** | |
build | |
coverage | |
cypress | |
node_modules | |
vendor |
function countdown(endDate) { | |
let days, hours, minutes, seconds; | |
endDate = new Date(endDate).getTime(); | |
if (isNaN(endDate)) { | |
return; | |
} | |
setInterval(calculate, 1000); |
/** | |
* User Defined Values | |
*/ | |
const agreedDisclaimer = false; | |
const apiToken = ''; | |
/** | |
* Dont need to touch anything below | |
*/ | |
const readline = require('readline'); |
Not for everyone. Each programmer has their own appreciation of what is good coding music.
(From most influential to least)
/** | |
* Hide shipping rates when free shipping is available. | |
* Updated to support WooCommerce 2.6 Shipping Zones. | |
* | |
* @param array $rates Array of rates found for the package. | |
* @return array | |
*/ | |
function my_hide_shipping_when_free_is_available( $rates ) { | |
$free = array(); | |
foreach ( $rates as $rate_id => $rate ) { |
<?php | |
/** | |
* Disables repeat purchase for products / variations | |
* | |
* @param bool $purchasable true if product can be purchased | |
* @param \WC_Product $product the WooCommerce product | |
* @return bool $purchasable the updated is_purchasable check | |
*/ | |
function sv_disable_repeat_purchase( $purchasable, $product ) { |