This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How I configured my plugins | |
new TerserPlugin({ | |
terserOptions: { | |
sourceMap: true, | |
parallel: true, | |
cache: true, | |
compress: true, | |
mangle: true, | |
toplevel: false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// based on https://gist.github.com/robballou/9ee108758dc5e0e2d028 | |
// install dependencies if needed: npm i -S jquery @types/jquery jsdom @types/jsdom | |
import { expect } from "chai"; | |
import { JSDOM } from "jsdom"; | |
import "mocha"; | |
import { Utils } from "ts/libs/utils/Utils"; | |
const { window } = new JSDOM(); | |
const $ = (global as any).jQuery = require("jquery")(window); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isNgElement(el) { | |
var is_ng = false; | |
Array.prototype.slice.call(el.attributes).filter(function(attr) { | |
if(/^_ng/.test(attr.name)){ | |
is_ng = true; | |
return; | |
} | |
}); | |
return is_ng; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Get all carriers available for this zon | |
*/ | |
public static function getCarriersByCountry($id_country, $id_state, $zipcode, $exiting_cart, $id_customer) | |
{ | |
// Create temporary Address | |
$addr_temp = new Address(); | |
$addr_temp->id_customer = $id_customer; | |
$addr_temp->id_country = $id_country; | |
$addr_temp->id_state = $id_state; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prestashop.on('updatedProduct', function(data) { | |
console.log(data.id_product_attribute); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// define a max for each attribute | |
// open the console then change the attribute to see the selected id | |
var max = { | |
581: 20, | |
582: 10 | |
} | |
prestashop.on('updatedProduct', function(data) { | |
const idProductAttribute = data.id_product_attribute; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.dp_field_container label { | |
display: inline-block !important; | |
width: 115px; | |
} | |
.dp_radio label { | |
display: block !important; | |
width: auto; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const condition = false; | |
const myArray = [ | |
"value 1", | |
"value 2", | |
condition && "value 3", | |
!condition && "value 4" | |
].filter(Boolean); | |
console.log(myArray); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function waitFor( prop ) { | |
return function( target, key, descriptor ) { | |
var originalMethod = descriptor.value; | |
descriptor.value = function (...args) { | |
const intv = setInterval(() => { | |
if (typeof window[prop] !== "undefined") { | |
clearInterval(intv); | |
originalMethod.apply(this, args); | |
} | |
}, 50); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_mapWindow : function(cinnamonwm, actor) { | |
actor._windowType = actor.meta_window.get_window_type(); | |
actor._notifyWindowTypeSignalId = actor.meta_window.connect('notify::window-type', Lang.bind(this, function () { | |
let type = actor.meta_window.get_window_type(); | |
actor._windowType = type; | |
})); | |
if (actor.meta_window.is_attached_dialog()) { | |
this._checkDimming(actor.get_meta_window().get_transient_for()); | |
} |