Bundler Build Feature Flags
Starting with 3.0.0-rc.3, esm-bundler builds now exposes global feature flags that can be overwritten at compile time:
- true (enable/disable Options API support, default: true)
- false (enable/disable devtools support in production, default: false)
Dark/light mode on/off button Not working
Handle with the query string of a URL
Goto MDN ↗new URLSearchParams(location.search).get('xxx')Effect data structure design
HTML Elements: <figure>
<figure> <img src="xxx.png" /> <figcaption>This is Optional Caption element</figcaption> </figure>Native deep clone objects
❌ Won't copy functions, Dates, undefined, and many more
JSON.parse(JSON.stringify(object))❌ OK, but requires lodash
_.cloneDeep(obj)✅ Native API !!!
Goto MDN ↗structuredClone(obj)grayscale
.gray { -webkit-filter: grayscale(100%); -moz-filter: grayscale(100%); -ms-filter: grayscale(100%); -o-filter: grayscale(100%); filter: grayscale(100%); filter: gray; }Frosted Glass Effect
.card { border-radius: 8px; backdrop-filter: blur(20px); background-color: rgba(255, 255, 255, 0.5); box-shadow: 0 1px 12px rgba(0, 0, 0, 0.25); border: 1px solid rgba(255, 255, 255, 0.3); }git-stash
I just found out that I can use git stash to save the dirty working! Amazing thing!
git stash : Stash the changes in a dirty working directory away
When you need to switch branches without committing the current content, just use it!
git stash git stash pop git stash list git stash drop / git stash clean git stash save "message"__dirname in ESM
import { dirname } from 'path' import { fileURLToPath } from 'url' const _dirname = typeof __dirname !== 'undefined' ? __dirname : dirname(fileURLToPath(globalThis._importMeta_.url))Social Sharing
<meta property="og:title" content="TITLE OF PAGE" /> <meta property="og:image" content="URL OF IMAGE ONLY" /> <meta property="og:url" content="URL OF WEBPAGE" /> <meta property="og:description" content="DESCRIPTION OF PAGE" />Custom cursor color
Cursor color is inherited from the input. If you only want to change the cursor color:
input { caret-color: red; }Move all files from one folder to another
How do I move all files from one folder to another using the command line?
find ~/Folder/ -type f -print0 | xargs -0 mv -t ~/dl # e.g find ./ -type f -iname "*.mp4" -exec mv {} ./dl \; find ./ -type f -iname "*.mkv" -exec mv {} ./dl \; # -type with the argument -type you can specify type file.on this statement that is the mean file.if using of -d that means directory. # -iname: the most common and obvious method to look for a file is using its -name argument.if you are not sure about its case-sensitivity you can use of -iname argument # - mv {} and finally to specify target directory and then moving the files on there using mv {} argument # media type # video # mp4,wmv,rmvb,avi,rm,mov,flv,mkv # zip # *.rar *.zip *.7z *.iso *.wav *.flac *.mp3 *.aac # image # *.png *.jpg *.gif *.jpeg *.bmpNice font for zh-cn
font-family: 'Liu Jian Mao Cao';git squash
To "squash" in Git means to combine multiple commits into one.
git checkout master //switch main branch git merge --squash dev //Merge multiple commits of a branch at once git commit -m 'xxx版' //commit the just 'merged commit' to the master branchgit rebase -i origin/masterMultiple-line overflow ellipsis
width: 418rpx; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;Full expanded contract of a Typescript type
stackoverflow: how-can-i-see-the-full-expanded-contract-of-a-typescript-type ↗// expands object types one level deep type Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never // expands object types recursively type ExpandRecursively<T> = T extends object ? (T extends infer O ? { [K in keyof O]: ExpandRecursively<O[K]> } : never) : TgitHooks
Conventional Commits ↗name desc feat 增加新功能 fix 修复问题/BUG style 代码风格相关无影响运行结果的 perf 优化/性能提升 refactor 重构 revert 撤销修改 test 测试相关 docs 文档/注释 chore 依赖更新/脚手架配置修改等 workflow 工作流改进 ci 持续集成 types 类型定义文件更改 wip 开发中 Click on the tDom(target) to close the cDom(specific)
document.addEventListener('click', event => { const cDom = document.querySelector('#filter-header') const tDom = event.target if (cDom === tDom || cDom.contains(tDom)) { // ... } else { cDom.style.display = 'none' } })Breakpoints
Variant Rule Description sm @media (min-width: 640px) Enable utility when the screen width is greater than 640px md @media (min-width: 768px) Enable utility when the screen width is greater than 768px lg @media (min-width: 1024px) Enable utility when the screen width is greater than 1024px xl @media (min-width: 1280px) Enable utility when the screen width is greater than 1280px 2xl @media (min-width: 1536px) Enable utility when the screen width is greater than 1536px Solve the problem of mac USB connection interruption
sudo killall -STOP -c usbd
彷徨
彷徨