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 send = function(content) { | |
const waitFor = (condFunc, cb, timeout = 5) => new Promise((resolve) => { | |
const f = () => { | |
if (condFunc()) { | |
resolve() | |
} else { | |
setTimeout(f, timeout) | |
} | |
} | |
setTimeout(f, timeout) |
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 pick, { pickAndGetRest } from "./pick" | |
describe("pick util", () => { | |
it("picks from an object", () => { | |
const obj = { | |
a: 1, | |
b: 2, | |
c: 3, | |
foo: "bar", | |
bar: "bah", |
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 NUMBERS = 1000000 | |
const TESTS = 100 | |
const startTime = Date.now() | |
console.log(`Testing calculating the sum of ${NUMBERS} numbers\n`) | |
const forLoops = [] | |
const whileLoops = [] |
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 { useState } from "react" | |
// tslint:disable-next-line:no-any | |
export const useLocalStorage = <T extends any>(key: string, initialValue: T) => { | |
const [storedValue, setStoredValue] = useState<T>(() => { | |
try { | |
// Get from local storage by key | |
const item = window.localStorage.getItem(key) | |
// Parse stored json or if none return initialValue | |
return item ? JSON.parse(item) : initialValue |
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
<html> | |
<heAD> | |
</HEAD> | |
<body> | |
<p>sdflkasdjföaslfkjasföl</p> | |
<script> | |
setInterval(() => { | |
document.querySelector('p').style.color = 'red' | |
}, 2000) |
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
0xAf16EA680090E81af0ACf5e2664a19a37F5a3c43 |
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
0xAf16EA680090E81af0ACf5e2664a19a37F5a3c43 |