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
/* eslint-disable */ | |
const fetch_ = require('node-fetch'); | |
const fetchWithTimeout = async (url, options, timeout) => { | |
const controller = new AbortController(); | |
const id = setTimeout(() => controller.abort(), timeout); | |
const response = await fetch(url, { | |
...options, |
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
import {ReadableStream} from 'node:stream/web'; | |
// Custom logger that accumulates log statements | |
const logger = { | |
logs: [], | |
log(...messages) { | |
this.logs.push(messages.join(' ')); | |
}, | |
error(...messages) { | |
this.logs.push(`ERROR: ${messages.join(' ')}`); |
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
async function checkAvailability(plate: string): Promise<string> { | |
const encodedPlate = encodeURIComponent(plate); | |
const url = `https://www.myplates.com/api/licenseplates/passenger/carbon-fiber/${encodedPlate}?_=${Date.now()}`; | |
const response = await fetch(url, { | |
headers: { | |
accept: 'application/json, text/javascript, */*; q=0.01', | |
'accept-language': 'en-US,en;q=0.9', | |
Referer: 'https://www.myplates.com/design/personalized/passenger/carbon-fiber/', | |
'Referrer-Policy': 'strict-origin-when-cross-origin', | |
}, |
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
#!/bin/bash | |
set -euxo pipefail | |
./pnpm exec typedoc \ | |
--treatWarningsAsErrors \ | |
--excludePrivate \ | |
--gitRevision master \ | |
--githubPages false \ | |
--plugin typedoc-plugin-markdown \ |
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
FROM node:16-buster | |
WORKDIR /app | |
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - | |
RUN echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list | |
RUN apt-get update | |
RUN apt-get install -y google-chrome-stable | |
COPY package.json ./ |
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 x = 0; | |
new Promise(resolve => resolve()).then(() => { | |
x = 1 | |
new Promise(resolve => resolve()).then(() => { | |
x = 2 | |
}) | |
}) | |
await flushAllMicrotasks() |
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 resize(imageDataUrl) { | |
return new Promise((resolve, reject) => { | |
const img = new Image() | |
img.addEventListener('error', reject) | |
img.addEventListener('load', () => { | |
try { | |
canvas.width = img.width | |
canvas.height = img.height | |
context.drawImage(img, 0, 0) | |
const imageData = context!.getImageData(0, 0, img.width, img.height) |
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 fs = require('fs'); | |
const fetch = require('isomorphic-fetch'); | |
async function go() { | |
const hashes = fs.readFileSync('hashes.txt', 'utf-8').split('\n'); | |
for (const hash of hashes) { | |
if (!hash.trim()) continue; | |
const response = await fetch(`https://api.github.com/repos/GoogleChrome/lighthouse/commits/${hash}`); | |
const json = await response.json(); |
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
#!/bin/bash | |
# Non-scripted Tasks: | |
# - Configure device name in Preferences > Sharing | |
# - Enable Remote Login & Remote Management in Preferences > Sharing | |
# - Enable automatic login/disable password after sleep in Preferences > Security & Privacy > General | |
# - Disable screensaver/sleep in Preferences > Energy Saver | |
# - Disable spotlight indexing of home directory | |
# - Add a runner in GitHub UI to grab your token https://github.com/<org>/<repo>/settings/actions/runners/new |
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 _ = require('lodash') | |
const express = require('express') | |
const movies = require('./movies.json') | |
const actors = [] | |
const roles = [] | |
/** | |
* Documentation | |
* | |
* Installation: npm install express lodash morgan |
NewerOlder