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
-- `menu_click`, by Jacob Rus, September 2006. | |
-- Ref: https://stackoverflow.com/questions/14669542/automatically-open-the-safari-debugger-when-the-iphone-simulator-is-launched | |
on find_by(arr, str) | |
repeat with elm in arr | |
if str contains elm then | |
return str | |
else | |
return null | |
end if |
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 intersectionSet = (a, b) => { | |
const setB = new Set(b); | |
return Array.from(new Set([...new Set(a)].filter((x) => setB.has(x)))); | |
}; | |
const intersectionArr = (a, b) => a.filter((x) => b.includes(x)); | |
const genTestArr = () => | |
[...Array(1000000)].map(() => Math.floor(Math.random() * 1000)); | |
// [...Array(1000000)].map(() => `${Math.floor(Math.random() * 1000)}`); |
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 collectExactMatchFiles = async (p: string, cache: Map<string, string[]>) => { | |
const collect = async (key: string) => { | |
const c = await Deno.readTextFile(key); | |
if (!cache.has(c)) { | |
cache.set(c, [key]); | |
return; | |
} | |
const e = cache.get(c); | |
e && cache.set(c, [...e, key]); | |
}; |
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
fucntion hexToHSL(hex) { | |
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex) | |
const r = parseInt(result[1], 16) / 255 | |
const g = parseInt(result[2], 16) / 255 | |
const b = parseInt(result[3], 16) / 255 | |
const max = Math.max(r, g, b) | |
const min = Math.min(r, g, b) | |
let h = 0 | |
let s = 0 | |
const l = (max + min) / 2 |