Skip to content

Commit 57fff9f

Browse files
authored
Merge pull request #419 from 1chooo/feat/#409
feat(portfolio): Support MDX Rendering in the Portfolio Page
2 parents a0ea83c + b7e10ce commit 57fff9f

13 files changed

+109
-287
lines changed

apps/web/src/app/mock/page.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import FilterSelectBox from "@/components/portfolio/v2/filter-select-box";
55
import FilterList from "@/components/portfolio/v2/filter-list";
66
import MarkdownRenderer from "@/components/markdown/markdown-renderer";
77
import { getPortfolioPosts } from "@/lib/db/portfolio";
8-
import { POSTS_PER_PAGE } from "@/lib/constants";
98
import config from "@/config";
109
import { LuEye } from "react-icons/lu";
10+
import "react-loading-skeleton/dist/skeleton.css";
1111

12-
const { title } = config;
1312

14-
import "react-loading-skeleton/dist/skeleton.css";
13+
const { title } = config;
14+
const POSTS_PER_PAGE = 9;
1515

1616
export const metadata = {
1717
title: `Portfolio | ${title}`,

apps/web/src/contents/portfolios/1chooo-com.md

+3-144
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: "Anon Chat"
3+
category: Web Development
4+
publishedAt: 2024-01-31
5+
summary:
6+
tags:
7+
-
8+
banner: /images/projects/anon-chat.png
9+
alt:
10+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: "AWS Educate 101"
3+
category: Chat Bot
4+
publishedAt: 2024-01-31
5+
summary:
6+
tags:
7+
-
8+
banner: /images/projects/aws-edu-101.png
9+
alt:
10+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: "Evolving Beasts"
3+
category: Chat Bot
4+
publishedAt: 2023-08-31
5+
summary:
6+
tags:
7+
-
8+
banner: /images/projects/evolving-beasts.png
9+
alt:
10+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: "Game Scope"
3+
category: Data Analysis
4+
publishedAt: 2023-01-31
5+
summary:
6+
tags:
7+
-
8+
banner: /images/projects/game-scope.png
9+
alt:
10+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: "Gym Route"
3+
category: App Development
4+
publishedAt: 2022-06-30
5+
summary:
6+
tags:
7+
-
8+
banner: /images/projects/gym-route.png
9+
alt:
10+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: "Hua Tank"
3+
category: Web Development
4+
publishedAt: 2023-01-31
5+
summary:
6+
tags:
7+
-
8+
banner: /images/projects/hua-tank.png
9+
alt:
10+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: "NCUFresh"
3+
category: Web Development
4+
publishedAt: 2022-07-31
5+
summary:
6+
tags:
7+
-
8+
banner: /images/projects/ncufresh.png
9+
alt:
10+
---
+3-140
Original file line numberDiff line numberDiff line change
@@ -1,152 +1,15 @@
11
---
22
title: "Refinaid"
3-
publishedAt: '2024-06-25'
3+
publishedAt: 2024-08-27
44
category: Web Development
55
tags:
66
- Go
77
- Python
88
- Leetcode
99
- Array
1010
- Hash Table
11-
summary: 'Given an array of integers `nums` and an integer `target`, *return indices of the two numbers such that they add up to `target`*.'
11+
summary:
1212
banner: /images/projects/refinaid.png
13-
alt: "LeetCode 0001. Two Sum - Hash Map Solution | Go, Python, C++"
14-
mathjax: true
13+
alt:
1514
---
1615

17-
Link 👉🏻 [1. Two Sum](https://leetcode.com/problems/two-sum/)
18-
19-
![Two Sum by Hugo](/images/banner/0001-two-sum.png)
20-
21-
### Description
22-
23-
24-
Given an array of integers `nums` and an integer `target`, *return indices of the two numbers such that they add up to `target`*.
25-
26-
You may assume that each input would have exactly one solution, and you may not use the same element twice.
27-
28-
You can return the answer in any order.
29-
30-
**Example 1:**
31-
- Input: `nums = [2,7,11,15], target = 9`
32-
- Output: `[0,1]`
33-
- Explanation: `Because nums[0] + nums[1] == 9, we return [0, 1].`
34-
35-
**Example 2:**
36-
- Input: `nums = [3,2,4], target = 6`
37-
- Output: `[1,2]`
38-
39-
**Example 3:**
40-
- Input: `nums = [3,3], target = 6`
41-
- Output: `[0,1]`
42-
43-
**Constraints:**
44-
45-
- <code>2 <= nums.length <= 10<sup>4</sup></code>
46-
- <code>-10<sup>9</sup> <= nums[i] <= 10<sup>9</sup></code>
47-
- <code>-10<sup>9</sup> <= target <= 10<sup>9</sup></code>
48-
- <code>Only one valid answer exists.</code>
49-
50-
**Follow-up:** Can you come up with an algorithm that is less than <code>O(n<sup>2</sup>)</code> time complexity?
51-
52-
### Intuition
53-
54-
Use HashMap to keep numbers and their indices we found.
55-
56-
57-
> Create a Hash Table in `GO` with `make` function <sup>[Golang Maps](https://www.geeksforgeeks.org/golang-maps/)</sup>, and use `map[key] = value` to set the value of the key.
58-
>
59-
> ```go
60-
> numMap := make(map[int]int)
61-
> ```
62-
63-
> **How to Work with maps?** <sup>[Go maps in action#Working with maps](https://go.dev/blog/maps)</sup>
64-
>
65-
> A two-value assignment tests for the existence of a key:
66-
>
67-
> ```go
68-
> i, ok := m["route"]
69-
> ```
70-
>
71-
> In this statement, the first `value (i)` is assigned the value stored under the key "route". If that key doesn't exist, i is the value type's zero `value (0)`. The second `value (ok)` is a `bool` that is true if the key exists in the map, and false if not.
72-
>
73-
> To test for a key without retrieving the value, use an underscore in place of the first value:
74-
>
75-
> ```go
76-
> _, ok := m["route"]
77-
> ```
78-
>
79-
> To iterate over the contents of a map, use the range keyword:
80-
>
81-
> ```go
82-
> for key, value := range m {
83-
> fmt.Println("Key:", key, "Value:", value)
84-
> }
85-
> ```
86-
87-
### Approach
88-
89-
1. Traverse the `nums` array and store the difference between the `target` and the current `number` as the `key` and the `index` as the `value` in the HashMap.
90-
2. If the current `number` is already in the HashMap, return the `index` of the current `number` and the `index` stored in the HashMap.
91-
3. We still need to return an empty array if there is no solution.
92-
93-
94-
### Complexity
95-
- Time complexity: $O(n)$
96-
97-
- Space complexity: $O(n)$
98-
99-
### Code
100-
101-
```go
102-
// Go Solution
103-
func twoSum(nums []int, target int) []int {
104-
hashMap := make(map[int]int)
105-
106-
for i, num := range nums {
107-
if j, ok := hashMap[num]; ok {
108-
return []int{j, i}
109-
}
110-
hashMap[target - num] = i
111-
}
112-
113-
return []int{}
114-
}
115-
```
116-
117-
```python
118-
# Python Solution
119-
class Solution:
120-
def twoSum(self, nums: List[int], target: int) -> List[int]:
121-
hMap = {}
122-
123-
for i in range(len(nums)):
124-
if nums[i] in hMap:
125-
return [hMap[nums[i]], i]
126-
else:
127-
hMap[target - nums[i]] = i
128-
129-
return []
130-
```
131-
132-
```cpp
133-
// C++ Solution
134-
class Solution {
135-
public:
136-
vector<int> twoSum(vector<int>& nums, int target) {
137-
unordered_map<int, int> hashMap;
138-
139-
for (int i = 0; i < nums.size(); ++i) {
140-
int num = nums[i];
141-
if (hashMap.find(num) != hashMap.end()) {
142-
return {hashMap[num], i};
143-
}
144-
hashMap[target - num] = i;
145-
}
146-
147-
return {};
148-
}
149-
};
150-
```
151-
152-
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: "Thermal Calculator"
3+
category: App Development
4+
publishedAt: 2023-01-31
5+
summary:
6+
tags:
7+
-
8+
banner: /images/projects/thermal-calculator.png
9+
alt:
10+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: "TODAM-TW"
3+
category: Web Development
4+
publishedAt: 2024-05-31
5+
summary: A 500 commits Side Project is born, let's dive into how Hugo did it!
6+
tags:
7+
-
8+
banner: /images/projects/todam-tw.png
9+
alt:
10+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: "UML Editor"
3+
category: App Development
4+
publishedAt: 2024-06-30
5+
summary:
6+
tags:
7+
-
8+
banner: /images/projects/uml-editor.png
9+
alt:
10+
---

0 commit comments

Comments
 (0)