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 am = require('am') | |
async function main() { | |
const url = 'https://www.example.com' | |
const response = await fetch(url) | |
const responseHeaders = Object.fromEntries(resp.headers.entries()) | |
console.dir(responseHeaders) | |
return responseHeaders | |
} |
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
export class CachedFn<T> { | |
private cache: { | |
[key: string]: T | |
} = {} | |
private keys: string[] | |
private currKeyIndex = 0 | |
constructor(private fn: (arg: string) => T, private size: number = 100) { | |
this.keys = new Array(size) |
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 N = 1000000 | |
function fib(nth) { | |
if (nth < 3) { | |
return 1n | |
} | |
let a = b = 1n, c | |
for (let i = 3; i <= nth; i++) { | |
c = a + b | |
a = b, b = c |