Skip to content

Instantly share code, notes, and snippets.

@mpuz
mpuz / fixnode.txt
Created October 12, 2021 11:19
fix node js permissions
sudo chown -R $USER ~/.npm
sudo chown -R $USER /usr/lib/node_modules
sudo chown -R $USER /usr/local/lib/node_modules
echo "export PATH=$PATH:$(npm get prefix)/bin" >> ~/.bashrc
@mpuz
mpuz / duplicates.js
Created March 19, 2022 13:45
remove dulplicates in the array of objects by one of params
const filteredArr = arr.reduce((acc, current) => {
const x = acc.find(item => item.id === current.id);
if (!x) {
return acc.concat([current]);
} else {
return acc;
}
}, []);
@mpuz
mpuz / promiseforof.js
Created May 10, 2022 20:51
Promisify for of loo[
function doSomethingAsync(value) {
return new Promise((resolve) => {
setTimeout(() => {
console.log("Resolving " + value);
resolve(value);
}, Math.floor(Math.random() * 1000));
});
}
function test() {
@mpuz
mpuz / puppdep.sh
Created December 8, 2023 10:02
puppeteer dependencies
sudo apt-get install gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget