Skip to content

Instantly share code, notes, and snippets.

View ppbntl19's full-sized avatar
🎯
Focusing

Pooran Prakash ppbntl19

🎯
Focusing
View GitHub Profile
@ef4
ef4 / examples.md
Last active November 16, 2024 00:54
Webpack 5 Node Polyfills Upgrade Cheatsheet

Webpack 5 Node Polyfills Upgrade Cheatsheet

Webpack 4 automatically polyfilled many Node APIs in the browser. This was not a great system, because it could lead to surprisingly giant libraries getting pulled into your app by accident, and it gave you no control over the exact versions of the polyfills you were using.

So Webpack 5 removed this functionality. That means you need to make changes if you were relying on those polyfills. This is a quick reference for how to replace the most common patterns.

List of polyfill packages that were used in webpack 4

For each automatically-polyfilled node package name on the left, this shows the name of the NPM package that was used to polyfill it on the right. Under webpack 5 you can manually install these packages and use them via resolve.fallback.

#!/bin/bash
function clean-metadata {
clean-item $1 '/<fieldPermissions>/,/<\/fieldPermissions>/d'
clean-item $1 '/<userPermissions>/,/<\/userPermissions>/d'
clean-item $1 '/<recordTypeVisibilities>/,/<\/recordTypeVisibilities>/d'
clean-item $1 '/<recordTypeVisibilities>/,/<\/recordTypeVisibilities>/d'
clean-item $1 '/<categoryGroupVisibilities>/,/<\/categoryGroupVisibilities>/d'
clean-item $1 '/<applicationVisibilities>/,/<\/applicationVisibilities>/d'
clean-item $1 '/<tabVisibilities>/,/<\/tabVisibilities>/d'
@maujood
maujood / ApexHelper.cmp
Last active March 10, 2021 05:21
Utility Component to call Apex and SOQL from Lightning Components using just one line of code
<aura:component extensible="true"
controller="ApexHelperController">
{!v.body}
</aura:component>
Instruction for LibreOffice dependency installation
1. cd /usr/local
2. wget http://download.documentfoundation.org/libreoffice/stable/5.0.0/rpm/x86_64/LibreOffice_5.0.0_Linux_x86-64_rpm.tar.gz
3. cd LibreOffice_5.0.0_Linux_x86-64_rpm
4. yum localinstall *.rpm --skip-broken
5. yum install cairo
@noygal
noygal / Windows Subsystem for Linux version 1 and 2 (WSL) - node install guide.md
Last active October 16, 2024 01:06
Installing node via windows subsystem for linux

Windows 10 version 2004 - Installing Node.js on Windows Subsystem for Linux (WSL/WSL2)

UPDATE (Fall 2020): This gist is an updated version to the Windows 10 Fall Creators Update - Installing Node.js on Windows Subsystem for Linux (WSL) guide, I usually just keep here notes, configuration or short guides for personal use, it was nice to know it also helps other ppl, I hope this one too.

Windows updated windows subsystem for linux to version 2, as the F.A.Q stated you can still use WSL version 1 side by side with version 2. I'm not sure about existing WSL machines surviving the upgrade process, but as always backup and 🤞. NOTE: WSL version 1 is not replace/deprecated, and there ar

function translateError(msg) {
var newErr = new Error(msg); // placed here to get correct stack
return e => {
newErr.originalError = e;
throw newErr;
}
}
async function asyncTask() {
const user = await UserModel.findById(1).catch(translateError('No user found'))
@JonathanMH
JonathanMH / index.js
Created October 22, 2016 15:07
JSON Web Token Tutorial: Express
// file: index.js
var _ = require("lodash");
var express = require("express");
var bodyParser = require("body-parser");
var jwt = require('jsonwebtoken');
var passport = require("passport");
var passportJWT = require("passport-jwt");
@b0bbywan
b0bbywan / .gitlab-ci.yml
Created February 4, 2016 11:33
Build and Deploy a javascript app with Gitlab-Ci
image: node:argon
before_script:
- apt-get -qq update
- apt-get -qq install -y python2.7 python2.7-dev build-essential make gcc g++ libicu-dev
- npm -g install npm --silent
- "echo -e \"export default {CLIENT_ID: '$CLIENT_ID'}\" > app/scripts/settings.js"
- npm set progress=false
- npm install --silent
@zynick
zynick / download-file.js
Created January 6, 2016 12:17
download file ('save as') using javascript xhr
// http://stackoverflow.com/a/23797348/1150427
xhr.open('POST', url, true);
xhr.responseType = 'arraybuffer';
xhr.onload = function () {
if (this.status === 200) {
var filename = "";
var disposition = xhr.getResponseHeader('Content-Disposition');
if (disposition && disposition.indexOf('attachment') !== -1) {
var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
@hubertlepicki
hubertlepicki / setup.sh
Created May 12, 2015 06:32
PhantomJS 2.0.1 on codeship
# I am pasting that into setup steps
# binary provided by the amazing Codeship.io support
PHANTOMJS_URL="https://s3.amazonaws.com/codeship.io/checkbot/binaries/phantomjs_2.0.1"
set -e
rm -rf ~/.phantomjs
wget --continue "${PHANTOMJS_URL}" -O "${HOME}/cache/phantomjs"
ln -s "${HOME}/cache/phantomjs" "${HOME}/bin/"
chmod +x "${HOME}/bin/phantomjs"