ES2018:RegExp 新功能介紹

/s flag 為了解決目前的 dot(.) 無法比對到換行字元,因此新的 /s flag 又稱 dotAll mode。 const input = ` Lorem ipsum dolor sit amet, consectetur adipiscing hello world elit. Nam sit amet elit id risus aliquam porta. `; /hello.world/u.test(input); // false workarounds: /hello[\s\S]world/u.test(input); // true /hello[^]world/u.test(input) // true 新語法 …
Read more

Bash/Zsh 環境變數載入順序

login 與 non-login 為什麼要先談這個?因為 login shell 與 non-login shell,載入的檔案不同,這邊參照鳥哥的說明: login shell:取得 bash 時需要完整的登入流程的,就稱為 login sh …
Read more

在 macOS 上安裝 Docker

Option 1: 使用官網提供的安裝包 在官網可以直接下載 Stable 或 Edge 版的 Docker.dmg 安裝,新的安裝包會安裝「Docker for Mac」,裡面包含 Docker Engine、Docker …
Read more

Vim 如何在 insert mode 換行

使用 Vim 好一陣子了,但一直有個地方覺得不順,就是在打到要換行的時候,需要先按 <Esc> 回到 Normal mode 再按 o。儘管可以用 <C-[> 代替 Esc,右手還是有按錯的可能性, …
Read more

更新 Homebrew 後,啟動 vim 的問題

今天更新 Homebrew 之後,啟動 vim 時顯示錯誤: dyld: Library not loaded: /usr/local/opt/ruby/lib/libruby.2.4.3.dylib Referenced from: /usr/local/bin/vim Reason: image not found [1] 52248 abort vim 找到類似問題,原因是 vim 依賴舊版的 ruby,所以更新後無法啟動,解決方法是重 …
Read more

Linux command-line: find 指令用法

常用參數 type f: file d: directory l: symbolic p: pipe s: socket name iname: ignore case path mtime: modify time (day) atime: access time (day) ctime: create time (day) mmin: (minute) amin: (minute) cmin: (minute) size or: 可以簡寫為 -o not: 可以簡寫為 ! exec: execute delete 基本用法 # name find . -name findme # 找 'findme' find …
Read more

Arch Linux:環境設定與常用套件

GNOME 桌面設定 匯出與匯入設定檔 # 匯出 dconf dump / >~/.config/dconf/user.conf # 匯入 dconf load / <~/.config/dconf/user.conf 中文輸入法以及中文環境 安裝 fcitx(注音) fcitx 相關說明維基寫得很清楚,建議看一下。 # fcitx-im …
Read more