Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

日報 #1

Closed
r7kamura opened this issue May 6, 2022 · 12 comments
Closed

日報 #1

r7kamura opened this issue May 6, 2022 · 12 comments

Comments

@r7kamura
Copy link
Owner

r7kamura commented May 6, 2022

No description provided.

@r7kamura
Copy link
Owner Author

r7kamura commented May 6, 2022

WSLのUbuntu 20.04からWindowsのデフォルトブラウザでURLを開いてほしかったので、wsluを入れた。

インストール

sudo apt update
sudo apt install wslu

使用例

ghでそのリポジトリのホームページURLに設定されているやつを持ってきて、それを開く。

gh repo view --json homepageUrl --jq ".homepageUrl" | xargs wslview

@r7kamura
Copy link
Owner Author

r7kamura commented May 6, 2022

https://github.com/r7kamura/gialog-sync が壊れていたので直した。

Octokit::Client#markdown はStringを返すのだが、このエンコーディングがASCII-8BITになるらしい。マルチバイト文字列を含むMarkdownのStringを渡すと、変なStringが返ってくるので、JSON.dumpに渡すところでエラーが起きていた。

対策として、次のようにコードを変更した。

- client.markdown(string)
+ client.markdown(string).force_encoding('UTF-8')

ユースケース的にUTF-8で返ってくることが自明であるためこのように対応したが、実際のところはHTTPのレスポンスヘッダー等を見て判断してあげた方が良いとは思う。でもこれはライブラリ側の責務としたいところ。そしてoctokir.rbのIssueを見ると、2019年からそういう問題が指摘されているものの、まだOpenのままだった。

octokit/octokit.rb#1118

@r7kamura
Copy link
Owner Author

r7kamura commented May 6, 2022

最近よくGitHub APIを調べている中で不便に感じたので、少し調べ物をして、GitHub Docsで常に英語版を表示 という記事を書いた。

REDIRECTORという名前だけど、history.replaceState も使えるともっと良いかも。例えば、Amazon.co.jpのURLを正規化するとかそういうユースケースで使える。

@r7kamura
Copy link
Owner Author

r7kamura commented May 6, 2022

https://github.com/r7kamura/gialog 製のブログ (このブログのことだ) をローカルで開発する場合、submodulesを使うのが良さそうなので試してみた。

git submodule add https://github.com/r7kamura/nippo.git data
cd data
git checkout data
cd ..
echo .gitmodules >> .gitignore

同リポジトリのdataブランチを、dataディレクトリに持ってきますよという措置。gialogは元々 ./data ディレクトリにJSONファイルが置かれる前提で実装されているので、こうすると上手く動く。

@r7kamura
Copy link
Owner Author

r7kamura commented May 6, 2022

https://r7kamura.github.io/nippo/ に改善を加えた:

  • 記事タイトルを取り払い、日付だけ表示する
  • title要素を追加
    • トップページと記事ページの2パターン
  • 日付の形式をYYYY-MM-DDからYYYY年MM月DD日に変更

@r7kamura
Copy link
Owner Author

r7kamura commented May 6, 2022

@r7kamura
Copy link
Owner Author

r7kamura commented May 6, 2022

昔に書いた記事をたまたま見返していたけどいい記事

@r7kamura
Copy link
Owner Author

r7kamura commented May 6, 2022

この記事がよく閲覧されているようだったので、更に書き直した。

@r7kamura
Copy link
Owner Author

r7kamura commented May 6, 2022

@r7kamura
Copy link
Owner Author

r7kamura commented May 6, 2022

OBSの設定を調べて、Advanced Scene Switcherを入れ、Workシーンで50分作業したら強制的にBreakシーンに突入させるようにできた。

@r7kamura
Copy link
Owner Author

r7kamura commented May 6, 2022

@r7kamura
Copy link
Owner Author

r7kamura commented May 6, 2022

Googleドキュメントに貼り付けられるように、リッチテキストで現在開いているページをコピーできるChrome拡張が欲しい。JavaScriptを自分で書いて実現、というのはレイヤーが1つ上の物なので、これは上手く用途に合わなくて、惜しい。

@r7kamura r7kamura closed this as completed May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant