This file contains hidden or 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
button = document.createElement('button') | |
button.onclick = function() { console.log('you clicked me!') } | |
button.dispatchEvent(new Event('click')) | |
button.addEventListener('keydown', e => { | |
console.log('I received a keydown event', e.key) | |
}) | |
function aKeyboardEvent() { |
This file contains hidden or 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 serialCon = (timeArray, maxConcurrency) => { | |
let activePromiseCount = 0 | |
const times = [...timeArray] | |
const processNextPromise = () => { | |
const time = times.shift() | |
if (!time) return | |
const newPromise = new Promise((resolve) => |
This file contains hidden or 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 serialCon = (timeArray, maxConcurrency) => { | |
const startedPromises = [] | |
const times = [...timeArray] | |
const processNextPromise = () => { | |
const time = times.shift() | |
if (!time) return | |
const newPromise = new Promise((resolve) => |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="id"> | |
<body> | |
<h1 id="LCP">Heading 1</h1> | |
<script> | |
const lcpElement = document.getElementById("LCP"); | |
const rect = lcpElement.getBoundingClientRect(); | |
console.log('initial', JSON.stringify({ rect }, null, 2)); | |
console.log(`Initial size ${rect.width}px + ${rect.height}px`); |
This file contains hidden or 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
'use strict'; | |
module.exports = { | |
hooks: { readPackage }, | |
}; | |
function readPackage(pkg) { | |
if (pkg.name === 'antd-table-infinity') { | |
pkg.peerDependencies = { ...pkg.peerDependencies, antd: '^3.20.0' }; | |
} |
This file contains hidden or 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 EventEmitter = require('events').EventEmitter; | |
class Task extends EventEmitter { | |
constructor(cb, name = 'N/A', type = '') { | |
super(); | |
this.cb = cb; | |
this.name = name; | |
this.type = type; // will be used to determine which queue this task should be enqueued to | |
this.next = null; // can assign another task to .next for sequencing tasks | |
this.started = false; |
This file contains hidden or 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 latestTag = child.execSync('git describe --long').toString('utf-8').split('-')[0]; | |
const output = child | |
.execSync(`git log ${latestTag}..HEAD --format=%B%H----DELIMITER----`) | |
.toString("utf-8"); |
This file contains hidden or 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
// update package.json | |
fs.writeFileSync("./package.json", JSON.stringify({ version: String(newVersion) }, null, 2)); | |
// create a new commit | |
child.execSync('git add .'); | |
child.execSync(`git commit -m "chore: Bump to version ${newVersion}"`); | |
// tag the commit | |
child.execSync(`git tag -a -m "Tag for version ${newVersion}" version${newVersion}`); |
This file contains hidden or 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 child = require("child_process"); | |
const fs = require("fs"); | |
const output = child | |
.execSync(`git log --format=%B%H----DELIMITER----`) | |
.toString("utf-8"); | |
const commitsArray = output | |
.split("----DELIMITER----\n") | |
.map(commit => { |
This file contains hidden or 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 child = require('child_process'); | |
const output = child.execSync(`git log --format=%B%H----DELIMITER----`).toString('utf-8'); | |
const commitsArray = output.split('----DELIMITER----\n').map(commit => { | |
const [message, sha] = commit.split('\n'); | |
return { sha, message }; | |
}).filter(commit => Boolean(commit.sha)); |
NewerOlder