Skip to content

Instantly share code, notes, and snippets.

View jherax's full-sized avatar
:atom:
Performance focused

David Rivera jherax

:atom:
Performance focused
View GitHub Profile
@jherax
jherax / absmartly.config.json
Last active April 19, 2022 06:02
ABSmartly configuration test
{
"assignments": [
{
"experiment": "MEDICARE_REPLACEMENTS",
"pathName": "/",
"variant": 1,
"configs": [{
"apiTarget": "/content/landingpage/MEDICARE/",
"replacements": {
"data": {
@jherax
jherax / dynamic-imports.js
Created July 4, 2024 23:59
Tricks with JS Async / Await
/**
* Dynamic imports allow you to import modules asynchronously.
* This can significantly improve the load time of web applications
* by splitting the code into smaller chunks and loading them on demand.
*/
async function loadModule(moduleName) {
try {
const module = await import(`./modules/${moduleName}.js`);
module.default(); // Assuming the module exports a default function
// module.namedExport();
@jherax
jherax / promise.allSettled.js
Last active July 16, 2024 17:17 — forked from davidbarral/promises.js
Promise.allSettled: polyfill
/**
* The Promise.allSettled() method returns a promise that resolves
* after all of the given promises have either resolved or rejected,
* with an array of objects that each describe the outcome of each promise.
*
* For each outcome object, a `status` string is present.
* If the status is "fulfilled", then a `value` is present.
* If the status is "rejected", then a `reason` is present.
* The value (or reason) reflects what value each promise
* was fulfilled (or rejected) with.