Skip to content

Instantly share code, notes, and snippets.

View dawiidio's full-sized avatar

Dawid Wojda dawiidio

View GitHub Profile
{
let divider = 3;
let source = new Array(35).fill(0).map((x,i) => i);
new Array(Math.ceil(source.length/divider)).fill(divider).map((x, i) => new Array(x).fill(0).map((y, ii) => source[divider*i+ii]))
}
const el = document.querySelector('#default-player > div > div.hover-display.pl-hover-transition-out > div > div.pl-controls-bottom.pl-flex.qa-controls-bottom > div.player-buttons-right > button.player-button.qa-fullscreen-button.pl-mg-r-1.pl-button__fullscreen--tooltip-left');
const keys = Object.keys(el);
const theirSecretInstance = el[keys[0]];
const turnOnTheatreMode = theirSecretInstance.memoizedProps.onClick;
turnOnTheatreMode(); // metoda włączająca theatre mode, nie wiem jak zachowa się po podmianie playera
let sum = (accountNumber) => {
const parsePriceString = priceStr => parseFloat(priceStr.replace(/\s\w\W/g, '').replace(',', '.'), 2);
const parseToReadablePriceStr = str => parseFloat(str).toFixed('2');
const cartViewProducts = Array.from(document.querySelectorAll('.cart-view-product'));
const supplyCostStr = document.querySelector('.cart-view-rundown-amount').innerText;
const supplyCost= parsePriceString(supplyCostStr);
class Products {
constructor({
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Test</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
@dawiidio
dawiidio / getPropValueByStringPath.js
Created April 15, 2018 18:06
Take the value from under the key from JS object basing on string path
const getPropValueByStringPath = (target, str) => {
const path = str.split('.');
const key = path.shift();
if(path.length !== 0 && target[key] instanceof Object)
return getPropValueByStringPath(target[key], path.join('.'));
else if(path.length === 0)
return target[key];
}