Skip to content

Instantly share code, notes, and snippets.

View enpitsuLin's full-sized avatar
🐣
keep young, keep naive

Ming Lin enpitsuLin

🐣
keep young, keep naive
View GitHub Profile
type Theme = 'system' | 'dark' | 'light'
export default function useTheme() {
const [theme, setTheme] = useState<Theme>(() => {
if (typeof localStorage === 'undefined') return 'system'
return (localStorage.getItem('theme') as Theme) || 'system'
})
useEffect(() => {
const root = document.documentElement
# enable run remote script
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
# Scoop configruation
$env:SCOOP = 'E:\scoop' # custom scoop install dir
$env:SCOOP_GLOBAL = 'E:\scoop\apps' # custom scoop app install dir
[environment]::setEnvironmentVariable('SCOOP_GLOBAL', $env:SCOOP_GLOBAL, 'Machine')
[environment]::setEnvironmentVariable('SCOOP', $env:SCOOP, 'User')
Invoke-WebRequest -useb get.scoop.sh | Invoke-Expression
const arr = [new Date(), new RegExp(''), new String('test'), 'test', /test/, new Number(1), 1, BigInt(1), 1n]
type InferConstructorType<C> = C extends DateConstructor ? Date : C extends ((...args: any[]) => infer T) | (new (...args: any[]) => infer T) ?
T : unknown
function filterInstance<Constructor extends ((...args: any[]) => any) | (new (...args: any[]) => any)>(
t: Constructor
) {
return (item: any, _index: number, _arr: any[]): item is InferConstructorType<Constructor> => {
if (typeof item === 'object') {

Keybase proof

I hereby claim:

  • I am enpitsuLin on github.
  • I am enpitsulin (https://keybase.io/enpitsulin) on keybase.
  • I have a public key whose fingerprint is 0672 CB81 76D0 9B46 A823 B81C 85C8 36DC 516B 372C

To claim this, I am signing this object:

@enpitsuLin
enpitsuLin / 🎡 My last week in music
Last active May 23, 2023 01:22
🎡 My last week in music
πŸ₯‡ η”Ÿη”ŸδΈ–δΈ–ηˆ± - ε΄ι›¨ιœ Β· 0 plays
πŸ₯ˆ Cage - Tielle/SawanoHiroyuki[nZk] Β· 0 plays
πŸ₯‰ ┇Stranger┇唯死δ»₯θ§£θ„±οΌˆγ€Šδ»…δΈƒδΊΊγ€‹ζŽˆζƒOSTοΌ‰οΌˆηΏ»θ‡ͺ AliοΌ‰ - STRANGER_BTS/倧摐咂/δ½›η—›δΈΆ Β· 0 plays
ε…‰εΉ΄δΉ‹ε€– - G.E.M.邓紫棋 Β· 0 plays
γ‚«γ‚Ώγ‚ͺγƒ’γ‚€ - Aimer Β· 0 plays
@enpitsuLin
enpitsuLin / gatsby-node.js
Last active October 28, 2021 14:49
gatsby alias
exports.onCreateWebpackConfig = ({ actions }) => {
actions.setWebpackConfig({
resolve: {
alias: {
// alias like webpack configuration
'@': path.join(__dirname, './src')
}
}
});
};
@enpitsuLin
enpitsuLin / πŸ“Š Weekly development breakdown
Last active January 14, 2024 00:55
Weekly development breakdown
TypeScript 14 hrs 49 mins β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰β–‘β–‘β–‘β–‘β–‘β–‘ 71.3%
JavaScript 2 hrs 56 mins β–ˆβ–ˆβ–‰β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 14.2%
Other 1 hr 3 mins β–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 5.1%
JSON 59 mins β–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 4.8%
Diff 36 mins β–Œβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 2.9%