彷徨
  1. 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)
  2. Handle with the query string of a URL

    new URLSearchParams(location.search).get('xxx')
    Goto MDN ↗
  3. Effect data structure design

    Effect data structure design
  4. HTML Elements: <figure>

    <figure>
      <img src="xxx.png" />
      <figcaption>This is Optional Caption element</figcaption>
    </figure>
  5. 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 !!!

    structuredClone(obj)
    Goto MDN ↗
  6. grayscale

    .gray {
        -webkit-filter: grayscale(100%);
        -moz-filter: grayscale(100%);
        -ms-filter: grayscale(100%);
        -o-filter: grayscale(100%);
        filter: grayscale(100%);
        filter: gray;
    }
  7. 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);
    }
  8. 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"
  9. __dirname in ESM

    import { dirname } from 'path'
    import { fileURLToPath } from 'url'
    
    const _dirname = typeof __dirname !== 'undefined' ? __dirname : dirname(fileURLToPath(globalThis._importMeta_.url))
  10. 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" />
  11. Custom cursor color

    Cursor color is inherited from the input. If you only want to change the cursor color:

    input {
      caret-color: red;
    }
  12. 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 *.bmp
  13. Nice font for zh-cn

    font-family: 'Liu Jian Mao Cao';
  14. 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 branch
    git rebase -i origin/master
  15. Multiple-line overflow ellipsis

    width: 418rpx;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  16. gitHooks

    namedesc
    feat增加新功能
    fix修复问题/BUG
    style代码风格相关无影响运行结果的
    perf优化/性能提升
    refactor重构
    revert撤销修改
    test测试相关
    docs文档/注释
    chore依赖更新/脚手架配置修改等
    workflow工作流改进
    ci持续集成
    types类型定义文件更改
    wip开发中
    Conventional Commits ↗
  17. 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'
      }
    })
  18. Breakpoints

    VariantRuleDescription
    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
  19. Solve the problem of mac USB connection interruption

    sudo killall -STOP -c usbd
2020-PRESENT © YIHENG