黃省喬

@xq

Sean Huang https://ngseke.me

Joined on Dec 6, 2017

  • Sorucetree 動作對應 Checkout Commit 目前的前一個 commit git checkout HEAD~1 復原 git checkout - - is a alias of @{-1} which represents the name of the previous current branch
     Like  Bookmark
  • Screenshot 2024-07-25 at 12.23.19 去 chrome://net-internals/#hsts Delete domain security policies 輸入 localhost → Delete 可能會需要手動把網址的 https 的 s 去掉
     Like  Bookmark
  • 分頁 關閉其他分頁::tabo 下一個分頁::tab 上一個分頁::tabo 取代 Visual Mode 選中的文字 :s 取代。預設會取代整行 \%V 匹配在 Visual Mode 的範圍內 把選中範圍的 abc 替換成 efg:
     Like  Bookmark
  • interface Profile { name: string, age: number } const profile: Profile = { name: 'abc', age: 18 } // Wrong function setValueWrong (key: keyof Profile, value: any) { const foo = profile[key] // `foo` is typed here
     Like  Bookmark
  • TL;DR 考慮為 Flexbox 的子元素加上 min-width: 0 來解決未如預期收縮的問題。 <div class="flex"> <div class="min-w-0">...</div> </div> 原因 即使 Flexbox 子元素的 flex-shrink 預設值明明是 1,但在某些場合它卻不如預期縮小。(範例見此) <input/> 根據不同瀏覽器,它其實擁有隱含的 min-width,數值為 170px ~ 200px
     Like  Bookmark
  • 設定 SSH 不用密碼登入 # local ssh-copy-id -i ~/.ssh/id_rsa.pub pi@raspberrypi.local :::spoiler ssh-copy-id 做了以下事情: 將你的公鑰(在這個例子中是 id_rsa.pub)複製到目標主機(這裡是 raspberrypi.local)的 ~/.ssh/authorized_keys 文件中。 設置適當的權限和所有權,確保只有用戶 pi 可以讀取和寫入這個文件。 如何撤銷:
     Like  Bookmark
  • 安裝 iTerm2 https://iterm2.com/downloads.html :::spoiler brew tap homebrew/cask brew install --cask iterm2 ::: 安裝 zsh
     Like 1 Bookmark
  • 問題描述 在今年(2023)全新建立的專案,執行到 JamesIves/github-pages-deploy-action 步驟時會失敗,根據 log 可以得知是在 GitHub Actions 執行到 git push 時遇到 403 錯誤。 /usr/bin/git commit -m Deploying to page from @ ngseke/test@075776ff3f9a7b27bb5809efe605152205deabe5 🚀 --quiet --no-verify /usr/bin/git push --force ***github.com/ngseke/test.git github-pages-deploy-action/8rb7mcfwb:page remote: Permission to ngseke/test.git denied to github-actions[bot]. fatal: unable to access 'https://github.com/ngseke/test.git/': The requested URL returned error: 403 這是 GitHub 在 2023 年 2 月的這個變動所導致的,原先 GITHUB_TOKEN 會一律預設得到 read/write 的權限,但後來改成了 read-only 才使得 git push 失敗,因此只需要手動調整權限即可。
     Like 1 Bookmark
  • TL;DR 沒想到連 Dataset 本身也是一個 component,所以要記得匯入並 use 它。 // <script setup lang="ts"> import { computed } from 'vue' import { type EChartsOption } from 'echarts' import { use } from 'echarts/core' import { DatasetComponent } from 'echarts/components' import VueECharts from 'vue-echarts'
     Like  Bookmark
  • spyOn modules // myModule.ts export function foo () { return true } // anotherModule.spec.ts import * as myModule from './myModule'
     Like  Bookmark
  • 題目 實作函式 promisfy(),將 callback function 轉換成回傳 Promise 的函式。 const mockFetch = (callback) => { setTimeout(() => { callback('api result') }, 1000) } const promisfy = () => { /* implement this function */ }
     Like  Bookmark
  • 發生場景 以 ssh 協議 clone 公開的 repo 時 package.json 內包含以 URL 安裝的相依 解法 登入自己的或任意 GitHub 帳戶,在裡面添加本裝置的 ssh 公鑰。
     Like  Bookmark
  • 升級 react-scripts 移除 node-modules/ 執行 npm install --save --save-exact react-scripts@5.0.0 執行 npm i 補安裝缺少的 query-string 執行 npm i query-string 初始化 ESLint
     Like  Bookmark
  • https://youtu.be/7EmboKQH8lM https://youtu.be/2a_ytyt9sf8 https://youtu.be/Qjywrq2gM8o https://youtu.be/58jGpV2Cg50 https://youtu.be/sn0aFEMVTpA
     Like  Bookmark
  • 從值取得型別。 取得陣列中項目的型別 const list = [666, 'bruh', true] as const type Item = typeof list[number] // true | "bruh" | 666 // 💡 拆解步驟: type List = typeof list type ItemOfList = List[number]
     Like  Bookmark
  • 關於 CRUD 作法 以同義詞替換 💩 new (它甚至是形容詞而非動詞) → 👍 create 💩 delete → 👍 remove 👍 edit 或 update 👍 fetch 理由
     Like  Bookmark
  • Value(值) value 就是在執行時期,能夠在表達式中引用的變數。 例如 let x = 5 會建立一個叫做 x 的 value,而且可以透過 console.log(x) 把值印出來。 :::success 🌕 我喜歡用陰陽的陽來形容 value ::: ES6(JavaScript 本來就有的):
     Like  Bookmark
  • styleResources https://zh.nuxtjs.org/api/configuration-build/#styleresources 匯入全域的 sass,將常用的變數和 mixin 注入到所有的 .vue 組件裡,省去一個個在組件 style 區塊中重複撰寫 @import "..."。 首先安裝 @nuxtjs/style-resources npm i @nuxtjs/style-resources
     Like  Bookmark
  • Sean Huang / 2021-08-10 Interface 不加前綴 I 的理由 → TS 本身就已達成標注型別的目的 額外的心智負擔 // 如果帕斯卡命名法對你來說合理... interface IUser { name: string } // 那何不也這麼做?
     Like  Bookmark
  • Initialize project vue create project-name Install tailwind vue add tailwind Install pug loader
     Like  Bookmark