一時興起參加了 LeetCode 的 Weekly Contest #40,用Javascript只解出了第一題計算二元樹每層平均值,思維是用兩個陣列,一個存每層的平均,一個存每層的總數量,最後相除得到每層的平均,實作如下:
1 | /** |
一時興起參加了 LeetCode 的 Weekly Contest #40,用Javascript只解出了第一題計算二元樹每層平均值,思維是用兩個陣列,一個存每層的平均,一個存每層的總數量,最後相除得到每層的平均,實作如下:
1 | /** |
Sometimes I want to create empty branch for gh-pages or server-packages instead of branch from master, I will excute following command:
1 | git checkout --orphan empty.branch.name |
ESLint
extensionsettings.json
by pressing Ctrl,
Add following setting
1 | "eslint.validate": [ |
(Optional) Add "eslint.autoFixOnSave": true
for autofix on save.
It should work now, enjoy :)
Proxy means on behalf of
:
Proxy(Forward proxy)
on behalf ofuser
to reach websitesReverse proxy
on behalf ofserver
to receive users request
Thanks to Dean Sim’s picture on this answer, it is the best to help understand reverse proxy :
More detail on stackoverflow answer
To set up custom domain with HTTPS on Github Pages, there are 6 steps :
Open Developer tools (F12) => Settings (F1) => Enable JavaScript source maps
常看到HTML裡有data-
這個屬性, 其實這是HTML5才有的,透過讓每個元素有自己的dataset,讓本來需要用ajax獲得或是hide起來的資料,可直接使用data-把值藏好!
存人物的多項資訊到一個DOM元素中
1 | <ul id="people"> |
Library argparse
in python could help user handle arguments passed through command prompt, below I record the most important functions :