This file contains hidden or 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
//https://my.aliexpress.com/wishlist/wish_list_product_list.htm?¤tGroupId=0&page=1 | |
const priceNodes = document.querySelectorAll('.price'); | |
const pricesCollection = Array.from(priceNodes); | |
var prices = pricesCollection.reduce((total, prc) => { | |
const prices = prc.textContent.trim().replace(/[^\d,-]/g, '').replace(/,/g, '.').split('-'); | |
const lowestPrice = Number(prices[0]); | |
const highestPrice = Number(prices[1]) || lowestPrice; | |
This file contains hidden or 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
{ | |
"configurations": [ | |
{"source": "https://github.com/Microsoft/vscode-recipes/tree/master/nodemon"}, | |
{ | |
"debug": "nodemon -e --inspect-brk js,graphql -x node src/index.js" | |
}, | |
{ | |
"type": "node", | |
"request": "attach", | |
"name": "BackEnd - Nodemon Debug", |
This file contains hidden or 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
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript | |
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); |
This file contains hidden or 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 listeners = (function listAllEventListeners() { | |
let elements = []; | |
const allElements = document.querySelectorAll('*'); | |
const types = []; | |
for (let ev in window) { | |
if (/^on/.test(ev)) types[types.length] = ev; | |
} | |
for (let i = 0; i < allElements.length; i++) { | |
const currentElement = allElements[i]; |
This file contains hidden or 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
@media only screen and (min-resolution: 2dppx), (min-resolution: 192dpi) { | |
background-image: url('/assets/build/img/sprite-2x.png'); | |
} |
This file contains hidden or 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
//source: https://remysharp.com/2010/07/21/throttling-function-calls | |
/* Let us work on performance issues while making resource-intensive things */ | |
/* Will wait until event is not stopped and wait param is finished, then the callback will be fired */ | |
function _debounce(func, wait, immediate) { | |
var timeout; | |
return function() { | |
var context = this, args = arguments; | |
var later = function() { | |
timeout = null; |
This file contains hidden or 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
//source: https://remysharp.com/2010/07/21/throttling-function-calls | |
/* Let us work on performance issues while making resource-intensive things */ | |
/* Will wait every `limit` miliseconds until the callback is executed */ | |
function _throttle(fn, threshold, scope) { | |
threshold || (threshold = 250); | |
var last, | |
deferTimer; | |
return function () { | |
var context = scope || this; |
This file contains hidden or 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
var query = '?param=param'; | |
window.history.replaceState(null, null, location.pathname + query); |
This file contains hidden or 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
var getUrlParameter = function getUrlParameter(sParam) { | |
var sPageURL = decodeURIComponent(window.location.search.substring(1)), | |
sURLVariables = sPageURL.split('&'), | |
sParameterName, | |
i; | |
for (i = 0; i < sURLVariables.length; i++) { | |
sParameterName = sURLVariables[i].split('='); | |
if (sParameterName[0] === sParam) { | |
return sParameterName[1] === undefined ? true : sParameterName[1]; |
NewerOlder