Skip to content

Instantly share code, notes, and snippets.

View PatrickJS's full-sized avatar

PatrickJS PatrickJS

View GitHub Profile
/*
Makes your remote containers low level API accessible via:
import accessFederatedContainer from "access-federated-containers";
accessFederatedContainer("app2")
*/
/** @typedef {import("webpack").Compiler} Compiler */
/** @typedef {import("webpack").Compilation} Compilation */
@PatrickJS
PatrickJS / emit-all-plugin.js
Created February 28, 2022 23:20 — forked from DrewML/emit-all-plugin.js
Output every file in a webpack build to the specified dist directory in the webpack config. Each file is output after having each loader run against it, but before the webpack module wrapper is added.
const path = require('path');
module.exports = class EmitAllPlugin {
constructor(opts = {}) {
this.ignorePattern = opts.ignorePattern || /node_modules/;
}
shouldIgnore(path) {
return this.ignorePattern.test(path);
}
@PatrickJS
PatrickJS / getOrLoadRemote.js
Created February 27, 2022 09:38 — forked from ScriptedAlchemy/getOrLoadRemote.js
The Right Way to Load Dynamic Remotes
/**
*
* @param {string} remote - the remote global name
* @param {object | string} shareScope - the shareScope Object OR scope key
* @param {string} remoteFallbackUrl - fallback url for remote module
* @returns {Promise<object>} - Federated Module Container
*/
const getOrLoadRemote = (remote, shareScope, remoteFallbackUrl = undefined) =>
new Promise((resolve, reject) => {
// check if remote exists on window
@PatrickJS
PatrickJS / BrowserDeviceInfo.js
Created January 30, 2022 02:21 — forked from TrevorJTClarke/BrowserDeviceInfo.js
A quick list of browsers and devices for use in testing. Chrome is used for all devices that need simulation.
var devices = [
{ name: 'Desktop - Huge', width: 2880, height: 1800, ratio: 2, type: 'desktop' },
{ name: 'Desktop - Extra Large', width: 1920, height: 1080, ratio: 1, type: 'desktop' },
{ name: 'Desktop - Large', width: 1440, height: 900, ratio: 1, type: 'desktop' },
{ name: 'Desktop - HiDPI', width: 1366, height: 768, ratio: 1, type: 'desktop' },
{ name: 'Desktop - MDPI', width: 1280, height: 800, ratio: 1, type: 'desktop' },
{ name: 'Laptop with HiDPI screen', width: 1440, height: 900, ratio: 2, type: 'desktop' },
{ name: 'Laptop with MDPI screen', width: 1280, height: 800, ratio: 1, type: 'desktop' },
{ name: 'Laptop with touch', width: 1280, height: 950, ratio: 1, type: 'desktop' },
{ name: 'Tablet - Portrait', width: 768, height: 1024, ratio: 1, type: 'tablet' },
@PatrickJS
PatrickJS / haproxy.config
Created January 25, 2021 18:47 — forked from bwiggs/haproxy.config
HAProxy Config File Example
global
#debug # uncomment to enable debug mode for HAProxy
defaults
mode http # enable http mode which gives of layer 7 filtering
timeout connect 5000ms # max time to wait for a connection attempt to a server to succeed
timeout client 50000ms # max inactivity time on the client side
timeout server 50000ms # max inactivity time on the server side
backend legacy # define a group of backend servers to handle legacy requests
@PatrickJS
PatrickJS / GetOptimizationStatus.md
Created September 27, 2020 05:53 — forked from naugtur/GetOptimizationStatus.md
V8 %GetOptimizationStatus

%GetOptimizationStatus return a set of bitwise flags instead of a single value, to access the value, you need to take the binary representation of the returned value. Now, for example, if 65 is returned, the binary representation is the following:

(65).toString(2).padStart(12, '0');
// 000001000001

Each binary digit acts as a boolean with the following meaning:

@PatrickJS
PatrickJS / zoom-bombing.php
Created April 3, 2020 17:26 — forked from nekromoff/zoom-bombing.php
Zoom bombing - identify Zoom existing meeting IDs
<?php
/*
Identify existing meetings/meeting IDs on Zoom.us call app
License: Public domain. Use for pranking only. Any other use prohibited.
https://gist.github.com/nekromoff/48ec26cbaecc31fccb202d1efa7d0657
*/
$ch = curl_init();
export const h=(t,p,...c)=>({t,p,c,k:p&&p.key})
export const render=(e,d,t=d.t||(d.t={}),p,r,c)=>
// arrays
e.pop?e.map((e,p)=>render(e,d,t.o&&t.o[p])):
// components
e.t.call?(e.i=render((render.c=e).t({children:e.c,...e.p},e.s=t.s||{},t=>
render(Object.assign(e.s,t)&&e,d,e)),t.i||d,t&&t.i||{}),e):(
// create notes
e.d=t.d||(e.t?document.createElement(e.t):new Text(e.p)),
// diff props
const { createServer } = require('http');
createServer((req, res) => {
res.writeHead(200, {
Connection: 'Transfer-Encoding',
'Content-Type': 'text/html; charset=utf-8',
'Transfer-Encoding': 'chunked'
});
res.write(`