This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const R = require('ramda') | |
let object = [{ | |
Name: 'a', | |
Records: [{ | |
Value: '1.2.3.4.5' | |
}], | |
Type: 'winner' | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const timeout = ms => new Promise(res => setTimeout(res, ms)) | |
async function delayFunc(delay, func, input) { | |
await timeout(delay) | |
return func(input) | |
} | |
let myPromise = input => { | |
return new Promise((resolve, reject) => { | |
console.log('HI ', input) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetch = require('node-fetch'); | |
const getPostObj = ({ branch = 'main', msg = 'auto commit', content = '', file_path = null, action = 'update' }) => ({ | |
branch, | |
commit_message: msg, | |
"actions": [ | |
{ | |
action, | |
file_path, | |
content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let obj = [...Array(11).keys()].reduce((prev, current) => { | |
prev[current] = true | |
return prev | |
}, {}) | |
console.log(obj); | |
/* | |
{ 0: true, | |
1: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function executeSequentially(promiseFactories) { | |
var result = Promise.resolve(); | |
promiseFactories.forEach(function (promiseFactory) { | |
result = result.then(promiseFactory); | |
}); | |
return result; | |
} | |
const logger = async (input) => { | |
console.log('Heelloo', input) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//CLIENT SIDE | |
var somelib = somelib || {}; | |
somelib.queue = somelib.queue || []; | |
let pushObjectCorrect = { cmd: "someFunc1", args: "I am queeeued before the script is laoded" }; | |
let pushObjectCorrect22 = { cmd: "someFunc1", args: "I am queeeued before the script is laoded" }; | |
somelib.queue.push(pushObjectCorrect); | |
somelib.queue.push(pushObjectCorrect22); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getParameterByName = function (name) { | |
const regexS = "[\\?&]" + name + "=([^&#]*)"; | |
const regex = new RegExp(regexS); | |
const results = regex.exec(window.location.search); | |
if (results === null) { | |
return ""; | |
} | |
return decodeURIComponent(results[1].replace(/\+/g, " ")); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const creator = ({ variableHere = 'no', notHere = 'some-default' }) => { | |
let myObject = { | |
id: 'someId', | |
...(variableHere && { variableHere }), | |
...(notHere && { notHere }), | |
}; | |
return myObject | |
} | |
let variableHere = 'yes' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: functions | |
package: | |
individually: true | |
exclude: | |
- node_modules/aws-sdk/** #Its already included in the aws lambda environment | |
custom: | |
webpack: | |
webpackConfig: ./webpack.config.js | |
includeModules: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function insertPixel(params) { | |
const pixelUrl = `https://YOUR_DISTRIBUTION.cloudfront.net/1x1.png`; | |
const pixel = document.createElement("img"); | |
pixel.setAttribute( | |
"src", | |
`${pixelUrl}${params}&someunique=${getRandomNumber()}` | |
); | |
pixel.setAttribute("height", "1"); | |
pixel.setAttribute("width", "1"); | |
document.body.appendChild(pixel); |
OlderNewer