echo 1 | sudo tee /sys/class/backlight/intel_backlight/brightness
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
// createCache.ts | |
export default function createCache(fetchFunction: () => Promise<any>, refreshInterval: number, retryAfter: number) { | |
let fetchPromise: null | ReturnType<typeof fetchFunction> = null; | |
const doThinInInterval = () => { | |
fetchFunction().then((data) => { | |
fetchPromise = Promise.resolve(data); | |
}) | |
.catch(() => setTimeout(doThinInInterval, retryAfter)); | |
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
// https://leetcode.com/problems/lru-cache/submissions/ | |
class LRUCache { | |
obj: Record<number, { val: number; acc: number }>; | |
capacity: number; | |
size: number; | |
acc: number; | |
cache: Record<number, [val: number, acc: number, key: number]>; | |
c: Map<number, [val: number, acc: number]> |
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 interpolate from './interpolate'; | |
describe('Interpolate for Translations', () => { | |
// eslint-disable-next-line jest/no-commented-out-tests | |
// it('blah', () => { | |
// expect(interpolate('asdf')).toEqual('asdf'); | |
// expect(interpolate('Hello {0}', ['World!'])).toEqual('Hello World!'); | |
// expect(interpolate('Hello {0} {0}', ['World!'])).toEqual('Hello World! World!'); | |
// expect(interpolate('Hello {0} {1} {2}!', ['World!', 'Welcome', 'here'])).toEqual('Hello World! Welcome here!'); | |
// expect(interpolate('Hello {0} {1} {2}! {1} {2}!', ['World!', 'Welcome', 'here'])).toEqual( |
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
# https://android.stackexchange.com/a/199496 | |
adb forward tcp:9222 localabstract:chrome_devtools_remote | |
wget -O tabs.json http://localhost:9222/json/list |
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
Functional Programming Jargon in simple terms: | |
https://github.com/hemanth/functional-programming-jargon | |
Professor Frisby's Mostly Adequate Guide to Functional Programming (book): | |
https://drboolean.gitbooks.io/mostly-adequate-guide/content/ | |
A series on FP in JS from Eric Elliott: | |
https://medium.com/javascript-scene/the-rise-and-fall-and-rise-of-functional-programming-composable-software-c2d91b424c8c | |
Some introduction to Monads: |
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 vehicleToHtml = obj => { | |
return `<div id="${obj.id}">${obj.name}</div>`; | |
}; | |
$.ajax({ | |
url: '/get/all/vehicles', | |
success: vehicles => { | |
const html = vehicles.map(vehicleToHtml); | |
// const html = vehicles.map(v => new Vehicle(v)).map(v => v.toHtml()); | |
document.querySelector('#list').innerHTML = html; |
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
<!doctype html> | |
<html> | |
<head> | |
<meta name="charset" content="utf-8"/> | |
<title></title> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> | |
<meta name="author" content="Adam Beres-Deak"/> | |
<meta name="viewport" content="width=device-width"/> | |
<style> | |
body { |