Blog

How to set Environment Variable on NodeJS

###如何設定 NodeJs Environment Variable 解決方法: 可以直接在 command line 設定 set ENV_VARIABLE=9000 && npm start 可以在package.json 上設定 e.g. "scripts": { "start": "set PORT=9000 && yarn run swagger …

How to get distinct values from an array of objects in JavaScript

今日有個 task 其中一個地方要在 Array of Json object 中 Distinct 一個 property const data = [ { id: 1, category: 'fruit', name: 'Apple', }, { id: 2, category: 'fruit', name: 'Banana', }, { id: 3, …

Firebase ReactJs routing issue - Page not found

使用 firebase hosting 來 host reactjs 既時候 出現了以下問題 當我直接在 browser 輸入 ReactJs 的 route 既時候 出現了 Page Not Found This file does not exist and there was no index.html found in the current …

Git undo local commit

久唔久就會大意地 Commit 錯野 發現以下這個 git command Git undo pushed commit and keep changes unstage 解決方法 git reset HEAD^

failed to extract shortcode: template for shortcode "alert" not found

Hugo Error failed to extract shortcode: template for shortcode "alert" not found 解決方法 git submodule update --init --recursive Test hugo server --watch

ESLint couldnt find the plugin (when install dependencies using yarn)

今日嘗試用 command line (CLI) 執行 ESLint 時出現了以下的錯誤信息 # eslint command eslint ./src Error: Cannot find module 'eslint-config-airbnb'

Clear node-modules

我們可以使用以下指令到 clear Yarn / NPM 的 cache # yarn yarn cache clean # npm npm cache clean --force # remove node_modules folder rm -rf node_modules Hope you find it useful

Git Error Unlink of File failed. Should I try again?

久不久我使用的 Git 便會出現以下問題 Unlink of file. ’ file path and name’ failed. Should I try again? (y/n)

Update WordPress Inside Docker Container Required FTP Access

今日 Update WordPress 既時候出現了 輸入 FTP 資料的畫面 To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not …

VSCode config trim trailing space when saving file

如果有用開source control, 做 code view 或 compare files 時 whitespace / Tab 會造成一些不必要既麻煩 很多IDE 都有一些設定或 plugin 可以在你儲存檔案時除去尾隨空格 在Visual Studio Code 有一些很好用的 settings 大家可在 Settings 上搜尋 …