Skip to content

Instantly share code, notes, and snippets.

View unlocomqx's full-sized avatar
🏠
Working from home

Tuni-Soft unlocomqx

🏠
Working from home
  • Module Dev - Tuni-Soft
  • [object Object]
View GitHub Profile
// How I configured my plugins
new TerserPlugin({
terserOptions: {
sourceMap: true,
parallel: true,
cache: true,
compress: true,
mangle: true,
toplevel: false,
@unlocomqx
unlocomqx / utils.spec.ts
Last active January 27, 2019 10:37
Testing jQuery with Mocha (TypeScript)
// 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);
@unlocomqx
unlocomqx / debug.js
Last active February 13, 2019 13:01
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;
}
/*
* 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;
prestashop.on('updatedProduct', function(data) {
console.log(data.id_product_attribute);
});
// 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;
.dp_field_container label {
display: inline-block !important;
width: 115px;
}
.dp_radio label {
display: block !important;
width: auto;
}
const condition = false;
const myArray = [
"value 1",
"value 2",
condition && "value 3",
!condition && "value 4"
].filter(Boolean);
console.log(myArray);
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);
_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());
}