Skip to content

Commit

Permalink
Merge pull request #40 from brklntmhwk/39-tweak
Browse files Browse the repository at this point in the history
refactor(overall): ✨ tweak articles, frontmatter config, and env vars
  • Loading branch information
brklntmhwk authored Aug 13, 2024
2 parents 257d675 + 8712ddb commit 291ea68
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 72 deletions.
1 change: 0 additions & 1 deletion .dev.vars.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
TURNSTILE_SECRET_KEY=xxxxxx
[email protected]
RESEND_API_KEY=xxxxxx
LOCAL_DB_PATH=.wrangler\\state\\v3\\d1\\miniflare-D1DatabaseObject\\xxxxxx.sqlite
4 changes: 1 addition & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
UNSPLASH_API_ACCESS_KEY=xxxxxx
PUBLIC_TURNSTILE_SITE_KEY=xxxxxx
CLOUDFLARE_ACCOUNT_ID=xxxxxx
D1_DB_ID=xxxxxx
D1_DB_API_TOKEN=xxxxxx
LOCAL_DB_PATH=.wrangler\\state\\v3\\d1\\miniflare-D1DatabaseObject\\xxxxxx.sqlite
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ This project adopts Issue-driven Development.

#### Outside the container

1. Create `.env` and `.env.vars` at the root
- see `.env.example` and `.env.vars.example` for reference, respectively
1. Create `.env` and `.dev.vars` at the root
- see `.env.example` and `.dev.vars.example` for reference, respectively
- At this moment, you can't set the `LOCAL_DB_PATH` var yet

#### Inside the container
Expand Down
82 changes: 64 additions & 18 deletions frontmatter.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,25 @@
{
"title": "blog",
"path": "[[workspace]]/src/content/blog",
"contentTypes": ["blog"],
"contentTypes": [
"blog"
],
"defaultLocale": "en"
},
{
"title": "news",
"path": "[[workspace]]/src/content/news",
"contentTypes": ["news"],
"contentTypes": [
"news"
],
"defaultLocale": "en"
},
{
"title": "page",
"path": "[[workspace]]/src/content/page",
"contentTypes": ["page"],
"contentTypes": [
"page"
],
"defaultLocale": "en"
}
],
Expand All @@ -38,7 +44,11 @@
"frontMatter.content.draftField": {
"name": "draft",
"type": "choice",
"choices": ["draft", "in progress", "published"]
"choices": [
"draft",
"in progress",
"published"
]
},
"frontMatter.taxonomy.seoTitleLength": 90,
"frontMatter.taxonomy.contentTypes": [
Expand Down Expand Up @@ -223,7 +233,12 @@
"schema": {
"title": "Categories",
"type": "object",
"required": ["title", "slug", "color"],
"required": [
"title",
"slug",
"ruby",
"color"
],
"properties": {
"title": {
"type": "string",
Expand All @@ -233,6 +248,10 @@
"type": "string",
"title": "Slug"
},
"ruby": {
"type": "string",
"title": "Ruby"
},
"color": {
"type": "string",
"title": "Color"
Expand All @@ -245,7 +264,12 @@
"schema": {
"title": "Tags",
"type": "object",
"required": ["title", "slug", "color"],
"required": [
"title",
"slug",
"ruby",
"color"
],
"properties": {
"title": {
"type": "string",
Expand All @@ -255,6 +279,10 @@
"type": "string",
"title": "Slug"
},
"ruby": {
"type": "string",
"title": "Ruby"
},
"color": {
"type": "string",
"title": "Color"
Expand Down Expand Up @@ -302,27 +330,38 @@
},
"Code block with specified language": {
"description": "Insert code block snippet",
"body": ["```[[language]] title=\"[[filename]]\"", "", "```"],
"body": [
"```[[language]] title=\"[[filename]]\"",
"",
"```"
],
"fields": [
{
"name": "language",
"title": "Language",
"type": "choice",
"choices": [
"html",
"astro",
"bash",
"c",
"css",
"dockerfile",
"html",
"javascript",
"typescript",
"rust",
"yml",
"astro",
"jsx",
"tsx",
"json",
"jsx",
"markdown",
"mdx",
"bash",
"txt"
"nix",
"python",
"rust",
"shell",
"sql",
"toml",
"tsx",
"typescript",
"txt",
"yml"
],
"single": true,
"default": "markdown"
Expand All @@ -338,7 +377,10 @@
},
"Callout": {
"description": "Insert a callout",
"body": ["> [![[type]] ][[symbol]][[title]]", "> [[content]]"],
"body": [
"> [![[type]] ][[symbol]][[title]]",
"> [[content]]"
],
"fields": [
{
"name": "type",
Expand All @@ -360,7 +402,11 @@
"name": "symbol",
"title": "Symbol",
"type": "choice",
"choices": ["+", "-", " "],
"choices": [
"+",
"-",
" "
],
"single": true,
"default": " "
},
Expand Down
49 changes: 27 additions & 22 deletions src/content/blog/en/pomodoro-shortcut.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Free pomodoro timer shortcut built only with the genuine Apple Clock app
draft: published
publishedAt: 2024-08-08T03:05:43.193Z
type: blog
modifiedAt: 2024-08-09T02:52:38.552Z
modifiedAt: 2024-08-13T04:45:14.521Z
category:
slug: learning
metadata: en/categories
Expand All @@ -20,7 +20,7 @@ description: Learn how to create a pomodoro timer shortcut with the Apple Clock

[The Pomodoro® Technique](https://www.pomodorotechnique.com/) plays a pivotal role in enhancing our productivity in modern society and there has been a bunch of pomodoro timer apps available in app stores.

That said, it turned out that few of them were really my cup of tea. Some have very limited features for free tier users, whereas some have a lot of bells and whistles that I don't use. Given that, I embarked on creating it on my own with the Apple shortcut.
That said, it turned out that few of them were really my cup of tea. Some have very limited features for free tier users, whereas some have a lot of bells and whistles that I mightn't use. Given that, I embarked on creating it on my own with the Apple shortcut.

> [!info]-What's the Pomodoro® Technique?
> The Pomodoro® Technique utilizes fixed time intervals for focused work, usually 25 minutes, followed by short breaks. This structured approach keeps the mind alert and engaged, significantly reducing the inclination to procrastinate and enabling a deeper focus on tasks.
Expand Down Expand Up @@ -51,7 +51,7 @@ https://www.icloud.com/shortcuts/b12a5c2e30484677b40a5f98b9e7774d

To start the pomodoro timer, all you have to do are:

1. Tap or click the shortcut icon(Put it on your home screen or somewhere in advance)
1. Tap or click the shortcut icon to run it(Put it on your home screen or somewhere in advance)
2. Set your working interval(25mins by default)
3. Set your breaking interval(5mins by default)

Expand All @@ -61,37 +61,42 @@ You'll see the timer counting down appear and now it's time to get your work sta

### The workflow

Behind the scenes, the pomodoro shortcut proceeds as follows:
Behind the scenes, the pomodoro shortcut proceeds as follows: (You can skip this section if you're not interested in the mechanism)

**Does the shortcut receives a parameter?**

↪️Yes

- Retrieve the work & break time from the param by splitting it

> [!info]
> You will see what it means later in this section
↪️No

- Ask you how long you're working(in minutes)
- Ask you how long you're taking a break(in minutes)

Hereafter, it runs the same processes

- Set the work & break intervals to variables
- Wait for a few seconds
- Open the timer tab of the Apple Clock app
- Show a notification that lets you know the work interval's started
- multiply the work & break intervals by 60 to get them in seconds
- Set the work interval in seconds to a variable
- Wait for the work intervals in seconds
- Show an alert to check if you want to continue
- Open the timer tab of the Apple Clock app
- Show a notification that lets you know the break interval's started
- Set the break interval in seconds to a variable
- Wait for the break intervals in seconds
- Show an alert to check if you want to continue
- Concatenate the work & break intervals in minutes as a string
- Set the concatenated string to a variable
- Pass it to this shortcut and call it in itself
Hereafter, it runs on the same process

- 𝕏 Set the work & break intervals to variables
- ✋Wait for a few seconds
- ⏰Open the timer tab of the Apple Clock app
- 📢Show a notification that lets you know the work interval's started
- 🔄multiply the work & break intervals by 60 to get them in seconds
- 𝕏 Set the work interval in seconds to a variable
- ✋Wait for the work intervals in seconds
- ⚠️Show an alert to check if you want to continue
- If canceled, it gets out of the process here
- ⏰Open the timer tab of the Apple Clock app
- 📢Show a notification that lets you know the break interval's started
- 𝕏 Set the break interval in seconds to a variable
- ✋Wait for the break intervals in seconds
- ⚠️Show an alert to check if you want to continue
- If canceled, it gets out of the process here
- 🔄Concatenate the work & break intervals in minutes as a string
- 𝕏 Set the concatenated string to a variable
- 🔛Pass it to this shortcut and call it in itself

This shortcut can take a parameter in text and then retrieves the work & break interval times separately from it if it exists, which enables the recursive structure.
If not, it asks you how long, which is supposed to be the case only the first time.
Expand Down
45 changes: 25 additions & 20 deletions src/content/blog/ja/pomodoro-shortcut.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: 【無料ダウンロード】ポモドーロタイマー用ショート
draft: published
publishedAt: 2024-08-08T03:05:43.193Z
type: blog
modifiedAt: 2024-08-09T03:08:33.303Z
modifiedAt: 2024-08-13T04:46:18.086Z
category:
slug: learning
metadata: ja/categories
Expand All @@ -20,8 +20,8 @@ description: Apple のショートカット機能と純正時計アプリだけ

[ポモドーロテクニック(The Pomodoro® Technique)](https://www.pomodorotechnique.com/)は現代社会において人々の生産性を高める重要な役割を果たしています。そしてアプリ市場には数多のポモドーロタイマーアプリがあります。

とはいえ、私個人の要望をピッタリ満たしてくれるものは残念ながら見つかりませんでした。あるものは無料ユーザへの機能制限が厳しく、またあるものは「ポモドーロタイマーにそこまでは求めてないんだよな...」と思ってしまうくらいに機能が盛り込まれていました
そこで、Apple のショートカット機能を使って自作しよう!ということになりました
しかし、私個人の要望をピッタリ満たしてくれるものは残念ながら見つかりませんでした。あるものは無料ユーザへの機能制限が厳しく、またあるものは「ポモドーロタイマーにそこまでは求めてない...」と思ってしまう程に機能が盛り沢山
無いなら自分で作ろうということで、今回は Apple のショートカット機能を使って自作してみました

> [!info]-ポモドーロテクニックとは?
> ポモドーロテクニックとは、物事に集中するのに決められたインターバルに時間を小分けし、短期間で集中・休憩を繰り返すというものです。大抵は25分間集中し、その後は小休憩をはさみます。このアプローチは常に能動的な思考を促し、特に先延ばし傾向を軽減したり深い集中に入りやすくするのに役立ちます。
Expand Down Expand Up @@ -62,37 +62,42 @@ https://www.icloud.com/shortcuts/b12a5c2e30484677b40a5f98b9e7774d

### ワークフロー

ポモドーロショートカットは裏で次のような流れに沿って動いています。
ポモドーロショートカットは裏で次のような流れに沿って動いています。仕組みに興味がなければ読み飛ばしても問題はありません。

**ショートカットはパラメータを受け取っているか?**

↪️はい。

- 連結文字列を分解してパラメータから集中&休憩タイムをそれぞれ取り出す

> [!info]
> この処理については本章で後々説明があります
↪️いいえ。

- 集中タイムをユーザに聞く(分単位で)
- 休憩タイムをユーザに聞く(分単位で)

ここからは同じ流れに沿って動きます。

- 集中&休憩タイムを変数にセットする
- 数秒待つ
- 時計アプリのタイマータブを開く
- 集中タイムが始まった旨をユーザに通知する
- 集中&休憩タイムに 60 を掛けて秒単位に変換する
- 秒単位の集中タイムを変数にセットする
- 集中タイムの時間分待つ
- 続けるかどうか決定を促すアラートを表示する
- 時計アプリのタイマータブを開く
- 休憩タイムが始まった旨をユーザに通知する
- 秒単位の休憩タイムを変数にセットする
- 休憩タイムの時間分待つ
- 続けるかどうか決定を促すアラートを表示する
- 分単位の集中&休憩タイムを連結して文字列に変換する
- 連結文字列を変数にセットする
- その変数を自身に渡してもう一度起動する
- 𝕏 集中&休憩タイムを変数にセットする
- ✋数秒待つ
- ⏰時計アプリのタイマータブを開く
- 📢集中タイムが始まった旨をユーザに通知する
- 🔄集中&休憩タイムに 60 を掛けて秒単位に変換する
- 𝕏 秒単位の集中タイムを変数にセットする
- ✋集中タイムの時間分待つ
- ⚠️続けるかどうか決定を促すアラートを表示する
- キャンセルの場合ここで終了
- ⏰時計アプリのタイマータブを開く
- 📢休憩タイムが始まった旨をユーザに通知する
- 𝕏 秒単位の休憩タイムを変数にセットする
- ✋休憩タイムの時間分待つ
- ⚠️続けるかどうか決定を促すアラートを表示する
- キャンセルの場合ここで終了
- 🔄分単位の集中&休憩タイムを連結して文字列に変換する
- 𝕏 連結文字列を変数にセットする
- 🔛その変数を自身に渡してもう一度起動する

特筆すべきはこの再帰的とも言える構造とパラメータです。
ショートカットはパラメータを受け取ることができるので、そこで初回に設定した集中&休憩タイムを渡してしまえば次回以降はわざわざ聞く必要もなくなるね、ということになります。
Expand Down
4 changes: 4 additions & 0 deletions src/content/tags/en/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@
slug: iphone
ruby: iPhone
color: grey
- title: Obsidian
slug: obsidian
ruby: obsidian
color: purple
4 changes: 4 additions & 0 deletions src/content/tags/ja/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@
slug: iphone
ruby: iPhone
color: grey
- title: Obsidian
slug: obsidian
ruby: obsidian
color: purple
4 changes: 1 addition & 3 deletions src/lib/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ export const ACCOUNT_ID = 'brklntmhwk';
export const SITE_URL = 'https://younagi.dev';
export const UNSPLASH_BASE_URL = 'https://unsplash.com';
export const GITHUB_BASE_URL = 'https://github.com';
export const BREVO_FORM_URL = 'https://api.brevo.com/v3/smtp/email';
export const TURNSTILE_API_URL =
'https://challenges.cloudflare.com/turnstile/v0/api.js';
export const TURNSTILE_SITE_VERIFICATION_URL =
'https://challenges.cloudflare.com/turnstile/v0/siteverify';
export const SHOW_DRAFT_PAGES_IN_DEV = true;
export const CONTACT_NOTIFICATION_SUBJECT =
'younagi.dev からお問い合わせがありました';
export const CONTACT_NOTIFICATION_SUBJECT = 'younagi.dev: New Contact Message';
3 changes: 0 additions & 3 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
interface ImportMetaEnv {
readonly UNSPLASH_API_ACCESS_KEY: string;
readonly PUBLIC_TURNSTILE_SITE_KEY: string;
readonly CLOUDFLARE_ACCOUNT_ID: string;
readonly D1_DB_ID: string;
readonly D1_DB_API_TOKEN: string;
readonly LOCAL_DB_PATH: string;
}

Expand Down

0 comments on commit 291ea68

Please sign in to comment.