- Copy
~/.gnupg
folder from your Mac|GNU/Linux machine toC:\Users\username\AppData\Roaming\
folder on Windows(withwin4gpg
installed) - The name
.gnupg
shall be changed tognupg
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
// see -> https://en.wikipedia.org/wiki/Proxy_auto-config#:~:text=A%20proxy%20auto%2Dconfig%20(PAC,for%20fetching%20a%20given%20URL. | |
// 定义 findProxyForURL 函数,它接受初始化状态和配置文件 | |
const findProxyForURL = (init, profiles) => (url, host) => { | |
let result = init; | |
const scheme = url.substr(0, url.indexOf(":")); | |
do { | |
result = profiles[result]; | |
if (typeof result === "function") { | |
result = result(url, host, scheme); |
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
// see -> https://www.typescriptlang.org/docs/handbook/2/keyof-types.html | |
type ExcludeUnexpectedNumIdxSigKeyof<T> = keyof T extends number | |
? keyof T | |
: Extract<keyof T, string>; | |
type MapishMixed = { [k: number | string]: boolean }; | |
type M = ExcludeUnexpectedNumIdxSigKeyof<MapishMixed>; | |
// ^? M will be of type string | number | |
type MapishNumber = { [k: number]: boolean }; |
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
// Shall be excuted in W3C latest props table's webpage | |
// Current link https://www.w3.org/TR/CSS22/propidx.html | |
[...document.querySelectorAll("tbody>tr") ?? []].reduce((acc, tr) => { | |
const inheritance = tr.querySelector("td:nth-child(5)") | |
if (inheritance?.innerHTML === "yes\n") { | |
acc.push(tr.querySelector("td:nth-child(1)")?.innerText) | |
} | |
return acc |
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
// The if-else pattern is replaced by if-only expressions for consisitency and clarity. | |
// A new JavaScript program or subprogram is executed, a initial task is created | |
taskQueue.enqueue(initParse()) | |
// Event Loop | |
while everyTick { | |
if !callstack.isEmpty() {continue} | |
taskQueue.dequeue().excuteStepsByJSEngine() | |
while !microTaskQueue.isEmpty() { |
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
/** | |
* Thumbnail download script for a certain platform | |
* @github https://gist.github.com/beetcb/75b511714cec347b9362639e6ff3f923 | |
*/ | |
;(async () => { | |
// Prerequisite | |
const rightToggle = document.querySelector('.right-panel-toggle') | |
if (rightToggle.classList.contains('active')) { | |
rightToggle.click() | |
await new Promise(res=>setTimeout(2000, res)) |
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 readline = require('readline') | |
const read = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout, | |
}).input | |
// Prase key-by-key | |
read.isRaw = true |
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
// using spread expression | |
let [one, two, three] = [...'12', { ...'abc' }] | |
const obj = { one, two, three } | |
function realDeepClone(obj, key, clone) { | |
if (!key) { | |
clone = Object.defineProperties({}, Object.getOwnPropertyDescriptors(obj)) | |
} else { | |
clone[key] = Object.defineProperties( | |
{}, |
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
// 0.IS `addEventLister()` and `click` ... <EVENT> used? | |
// // => `this` === who triggered the <EVENT> | |
// 1.Is it an arrow function ? | |
// // => `this` in arrow function === `this` around(arrow function) the closest valid line | |
// 2.Is it `bind` `call` `apply` | |
// // => `this` === `this` inside those [key words method] | |
// 3.Is it called with prefix `.` | |
// // => `this` === who is in fornt of `.` | |
// // => no `.` added => `this` === window | |
const $ = console.log; |
NewerOlder