Moved to blog.waynechu.cc

# This blog is moving to blog.waynechu.cc, start anytime.

Wayne

Customize Mac sleep shortcut without any 3rd party software

Settings -> Keyboard -> Keyboard Shortcuts -> App Shortcuts -> Add new shortcut to All application, name is `Sleep` ![Screenshot 2023-1...

Wayne

GPT prompt concepts

#### 1. Chain of Thought Chain of Thought (CoT) is a prompting technique used to encourage the model to generate a series of intermedia...

Wayne

Stripe API 的發展史 - Stripe’s payments APIs: The first 10 years

看起來是蠻有趣的故事,先收起來有機會再詳讀 https://stripe.com/blog/payment-api-design

Wayne

About passwordless authentication

## TL;DR: 1. Single Sign-On (SSO) 2. Biometrics 3. Possession factors -> OTP 4. Magic links 再來簡單了解一下各分類: 1. SSO -> FB login, Google Lo...

Wayne

Rails 7 with bootstrap 5

照這個教學 https://jasonfleetwoodboldt.com/courses/stepping-up-rails/rails-7-bootstrap/

Wayne

How to use Active Record Encryption without Rails credential

This post will teach you how to use Active Record Encryption with Dotenv ### Step 1: generate credential First of all, follow [officia...

Wayne

Named parameters with flow.js

```js const constructOAuthAPIUrl = ( { path, redirectUri, state, scopes, }: { path: string, redirectUri: str...

Wayne

React hook use useEffect as useState callback

`useState` doesn't have callback function and it's asynchronous, so if we need to monitor when the state got changed, we need to combine ...

Wayne

Mac 外接滑鼠移動速度

下這個指令關閉智障的滑鼠移動加速,若沒關閉的話每次滑鼠移到按鈕旁邊就會變慢,有夠智障 ```sh defaults write .GlobalPreferences com.apple.mouse.scaling -1 ``` 聽說調過滑鼠移動速度後這個設定就會重新倍 ...

Wayne

DHH shares hey.com Gemfile

```rb ruby '2.7.1' gem 'rails', github: 'rails/rails' gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data # Actio...

Wayne

How to write a good test description

My logic is very similar to this article https://guilhermesimoes.github.io/blog/writing-good-test-descriptions 其實很簡單,就是 test description...

Wayne

Feature toggle - configuration over code

很久之前的 Post [Feature toggle (a.k.a Feature Flags) in Ruby and gems to use](https://waynechu.cc/posts/441-feature-toggle-a-k-a-feature-fla...

Wayne

Golang environment variable

1. Built-in `os` package 2. Ruby style `godotenv` https://github.com/joho/godotenv 3. Recommended `viper` https://github.com/spf13/viper ...

Wayne

Golang version manager

GVM: https://github.com/moovweb/gvm Built-in: https://icanhazdowntime.org/posts/2019-10-11-go-has-a-built-in-go-version-manager/ ## Re...

Wayne

How to revert git --amend commad?

1. use `git reflog` to see when did the ammend action happend, let's say it happened at HEAD@{4} 2. use `git reset --soft HEAD@{4}` 3. r...

Wayne

Latency Numbers Every Programmer Should Know

Copied from https://gist.github.com/jboner/2841832 Latency Comparison Numbers (~2012) ---------------------------------- L1 cache refere...

Wayne

壓力測試的工具 - JMeter

JMeter 是個可以拿來做 performance testing 的工具,可以併發 request 做壓力測試 https://jmeter.apache.org/ ![Screenshot 2020-06-29 18.13.02.png](https://wayn...

Wayne

Library v.s. Framework

終於看到一個簡單明瞭的分類方試 會 call 你的 method 的叫 framework, 只有你會 call 他的 method 的叫 library >- Framework: If you have code in a jar that you import a...

Wayne

How OTR (Off-the-Record) Messaging works

OTR stands for Off-the-Record Messaging, the OTR protocol was designed by cryptographers Ian Goldberg and Nikita Borisov and released on ...

Wayne

Blowfish algorithm (bcrypt)

How to store password in the database using bowfish algorithm to hash (using Python to demostrate) ```py import bcrypt salt = bcrypt.g...

Wayne

Fix timestamp precision problem in CI

用 Timecop freeze 時間時,會因為作業系統不同的關係導致 RSpec test 在 compare timestamp 時出現誤差值,導致在 local 能 pass 的 test case 在 CI 卻會 failed,以下提供看似正常但會出錯的 Test ...

Wayne

血淋淋的鍵盤設定之路 - Vortexgear Tab75

## Spec - 鍵盤:Vortexgear Tab75 - MacOS: 10.15.4 - Karabiner-Elements: 12.0.9 ## 鍵盤配置: `[ L1 ][ L2 ][ L3 ][ Space ][ R1 ][ R2 ][ R3 ]` ...

Wayne

Git 把分支的分支的改動轉移到 master 上

看到一個發文有附圖的[好文](https://medium.com/@glasses618/不要再-cherry-pick-了-e079d67404d6) 以下引用原文 如果今天有三支 branch:master、staging、feature/b。本來你在開發中的 ...

Wayne

Readable feature test with RSpec

可以用更語意的 method 來寫 spec,with `given`, `when`, `and`, `then` keywords Example: ```rb feature 'Enrolment' do scenario 'Enrolling in a c...

Wayne