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
// refer: https://github.com/antfu/plum-demo/blob/main/src/App.vue | |
function frame() { | |
const tasks: Function[] = [] | |
pendingTasks = pendingTasks.filter((i) => { | |
if (Math.random() > 0.4) { | |
tasks.push(i) | |
return false | |
} | |
return 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
export function safeAwait(promise, finallyFunc) { | |
return promise.then(data => { | |
return [ undefined, data ] | |
}).catch(error => { | |
return [ error, undefined ] | |
}) | |
} |
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
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )" | |
PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info) ⌚ %{$fg_bold[magenta]%}%*%{$reset_color%} | |
%(?:%{$fg_bold[green]%}$ :%{$fg_bold[red]%}$ )' | |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[yellow]%}git:(%{$fg[red]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}) %{$fg[yellow]%}✗" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[yellow]%})" |
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
alias ni="npm install" | |
alias ns="npm run serve" | |
alias nd="npm run dev" | |
alias nt="npm run test" | |
alias nb="npm run build" | |
alias rnm="rm -rf ./node_modules" | |
alias nvp="npm version patch" | |
alias nvm="npm version minor" | |
alias nvma="npm version major" |
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
module.exports = { | |
// Default: 80 | |
printWidth: 120, | |
// Default: 2 | |
tabWidth: 4, | |
// Default: false | |
useTabs: false, | |
// Default: true | |
semi: true, | |
// Default: false |
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
shutdown -s -t 5 |
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
rundll32.exe user32.dll LockWorkStation |
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
Promise.limitAll = function(promises, limit) { | |
return new Promise(resolve => { | |
let resolvedCount = 0; | |
let count = 0; | |
let res = []; | |
const len = promises.length; | |
function next(p, index) { | |
p().then(r => { | |
res[index] = r; |
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
function detectWhetherElementScrollToEnd(element) { | |
const { scrollLeft, scrollTop, offsetWidth, offsetHeight, scrollWidth, scrollHeight } = element; | |
if (scrollTop === 0) { | |
return 'scroll to top'; | |
} | |
if (scrollTop + offsetHeight >= scrollHeight) { | |
return 'scroll to end'; | |
} | |
if (scrollLeft === 0) { | |
return 'scroll to left'; |
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
[user] | |
name = xxxx | |
email = [email protected] | |
[alias] | |
co = checkout | |
st = status | |
ci = commit | |
br = branch | |
ps = push | |
pl = pull |
NewerOlder