$ brew install chromium
$ xattr -cr /Applications/Chromium.app
This file contains hidden or 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
#include <linux/init.h> | |
#include <linux/module.h> | |
#include <linux/kernel.h> | |
#include <linux/list.h> | |
#include <linux/slab.h> | |
struct birthday { | |
int day; | |
int month; | |
int year; |
This file contains hidden or 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
// use Optional instead unknown | |
type Optional = (undefined | null | number | string | Function | Optional[]) & { | |
[key: string]: Optional; | |
} | |
declare const value: Optional; | |
const d = value?.a?.b?.c?.d; | |
if (typeof d === 'number') d.toFixed(2); |
// T ====> [...T, E]
type Concat<T, E> = T extends any[] ? [...T, E] : [];
// union to intersection of functions
// UnionToIoFn<'a' | 'b'>
// ====> ((x: 'a') => void) & ((x: 'b') => void)
// ====> that equal to { (x: 'a'): void; (x: 'b'): void }
type UnionToIoFn =
$ npm i gg@latest
$ npm i gg-1.0.0@npm:[email protected]
import ggOld from 'gg-1.0';
import gg from 'gg';
$ [command] -v --verbose
$ [command] -V --version
sometimes we need to change context's type in function
const f1 = {
data: {
i: 0,
},
methods: {
inc() {
This file contains hidden or 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 wait = (t = 0) => new Promise(r => setTimeout(r, t)); | |
class Person { | |
name: string; | |
promise: Promise<any>; | |
constructor(name: string) { | |
this.name = name; | |
this.promise = new Promise((resolve) => { | |
resolve(undefined); | |
}); | |
} |
This file contains hidden or 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
class TextBoard { | |
/** | |
* 文字复制至剪切板 | |
* @param data 需要复制的文本 | |
*/ | |
public copy = async (data: string) => { | |
if (window.navigator.clipboard) { | |
try { | |
await window.navigator.clipboard.writeText(data) | |
} catch (err) { |