FIX: Posts are working pretty well, just need the /blog page with a list

This commit is contained in:
Hayden Hargreaves 2025-02-24 11:44:32 -07:00
parent 832d72347d
commit 0e5ca9d844
6 changed files with 231 additions and 36 deletions

View File

@ -9,15 +9,31 @@
div.blog-wrapper h3,
div.blog-wrapper h4,
div.blog-wrapper h5,
div.blog-wrapper h6,
div.blog-wrapper h6 {
@apply text-gray-300 px-4;
}
div.blog-wrapper p,
div.blog-wrapper ul,
div.blog-wrapper ol {
@apply text-gray-300;
div.blog-wrapper ol,
div.blog-wrapper table {
@apply text-gray-400 text-sm px-4 py-2;
}
div.blog-wrapper table {
@apply table-fixed w-full border border-gray-300 border-collapse;
}
div.blog-wrapper table th {
@apply text-blue-300 p-2 text-xl;
}
div.blog-wrapper table td {
@apply border border-gray-300 p-2 text-sm;
}
div.blog-wrapper ul {
@apply list-disc list-inside;
@apply list-disc list-outside;
}
div.blog-wrapper ol {
@ -25,34 +41,35 @@
}
div.blog-wrapper h1 {
@apply text-4xl font-bold;
@apply text-3xl font-bold py-6;
}
div.blog-wrapper h2 {
@apply text-3xl font-bold;
@apply text-xl font-bold p-4;
}
div.blog-wrapper h3 {
@apply text-2xl font-bold;
@apply text-lg font-bold p-4;
}
div.blog-wrapper h4 {
@apply text-xl font-bold;
@apply text-lg py-2;
}
div.blog-wrapper h5 {
@apply text-lg font-bold;
}
/* Same size as h5, but not bold */
div.blog-wrapper h6 {
@apply text-lg;
@apply text-xs text-gray-400;
}
div.blog-wrapper p {
@apply text-sm;
}
div.blog-wrapper blockquote {
@apply border-l-4 border-blue-300 p-4 my-4;
}
div.blog-wrapper a {
@apply underline hover:text-blue-300;
}
@ -63,35 +80,30 @@
pre {
background-color: #191724;
padding: 0.5rem 2rem;
margin-inline: 2%;
border-radius: 10px;
overflow-x: auto;
white-space: pre-wrap;
@apply text-sm bg-[#191724] p-4 my-4 rounded-lg overflow-x-auto whitespace-pre-wrap;
}
code.hljs {
color: #e0def4;
@apply text-[#e0def4];
}
.hljs-string,
.hljs-number,
.hljs-meta {
color: #f6c177;
@apply text-[#f6c177];
}
.hljs-punctuation,
.hljs-operator {
color: #908caa;
@apply text-[#908caa];
}
.hljs-comment {
color: #6e6a86;
@apply text-[#6e6a86];
}
.hljs-keyword {
color: #3e8fb0;
@apply text-[#3e8fb0];
}
.hljs-params,
@ -99,16 +111,16 @@
.hljs-methods,
.hljs-regexp,
code.language-python .hljs-meta {
color: #c4a7e7;
@apply text-[#c4a7e7];
}
.hljs-variable,
.hljs-attr {
color: #e0def4;
@apply text-[#e0def4];
}
.language_ {
color: #eb6f92;
@apply text-[#eb6f92];
}
.function_,
@ -117,7 +129,7 @@
.hljs-title,
code.language-python .hljs-built_in,
code.language-go .hljs-built_in {
color: #ea9a97;
@apply text-[#ea9a97];
}
.hljs-property,
@ -127,6 +139,6 @@
.hljs-selector-tag,
.hljs-selector-class,
code.language-ts .hljs-built_in {
color: #9ccfd8;
@apply text-[#9ccfd8];
}
}

View File

@ -0,0 +1,63 @@
Date: 2025-02-24
# Neovim: A Robust Alternative to Visual Studio Code
###### Author: Hayden Hargreaves
###### Date: February 24, 2025
<br />
In the realm of text editors and integrated development environments (IDEs), developers often find themselves choosing between feature-rich platforms like Visual Studio Code (VS Code) and minimalist, highly customizable editors like Neovim. This article explores why Neovim stands out as a strong choice, comparing it to VS Code, and incorporating insights from user experiences and surveys.
## Performance and Resource Usage
One of the primary advantages of Neovim is its performance. Neovim is designed to be lightweight, leading to faster startup times and lower memory consumption compared to VS Code. Users have noted:
> "Neovim is the clear winner. It is really fast starting up, there is almost no lag..."
This efficiency is particularly beneficial for developers working on large projects or those who prefer a snappy editing experience.
## Extensibility and Customization
Neovim offers extensive customization through its plugin ecosystem, allowing developers to tailor their editing environment to their specific needs. While VS Code also supports extensions, Neovim's approach provides deeper integration and flexibility. A user shared:
> "Neovim had a great plugin ecosystem... I started to understand the value of minimalism and how simplifying your setup can make you more productive."
For example, integrating a Language Server Protocol (LSP) in Neovim can be achieved with the following configuration:
```lua
-- Install 'nvim-lspconfig' plugin first
local lspconfig = require('lspconfig')
lspconfig.pyright.setup{} -- Python LSP
```
In contrast, setting up Python support in VS Code involves installing the Python extension from the marketplace, which provides similar functionality but with less opportunity for customization.
## Modal Editing Efficiency
Neovim inherits Vim's modal editing, enabling developers to perform complex text manipulations with minimal keystrokes. This feature can lead to increased productivity once mastered. For instance, deleting all lines containing a specific word in Neovim can be done with:
```vim
:g/word/d
```
Achieving the same in VS Code would typically require using the search functionality combined with manual deletion or a multi-cursor approach, which can be more time-consuming.
## Community and Ecosystem
While VS Code boasts a large user base, Neovim's community is known for its focus on innovation and embracing new features. This environment fosters rapid development of plugins and enhancements. As noted in a discussion:
> "Neovim has a much larger community that tends to be much more welcoming to new features."
> DEV.TO
## Popularity and Adoption
According to the 2024 Stack Overflow Developer Survey, Visual Studio Code remains the preferred IDE among developers, with 73.6% of respondents reporting its use.
> While Neovim's user base is smaller in comparison, its users often advocate for its efficiency and customization capabilities.
## Conclusion
Choosing between Neovim and Visual Studio Code depends on individual workflow preferences and project requirements. Neovim offers a performance-oriented, highly customizable environment that appeals to developers who value efficiency and control. Conversely, VS Code provides a user-friendly interface with extensive built-in features, suitable for those seeking convenience and a broad extension marketplace.
For a more in-depth comparison and personal experiences transitioning from VS Code to Neovim, consider watching the following video:
[7 Reasons I Chose Neovim Over VSCode](https://www.youtube.com/watch?v=vjzp_IpD61Y)

83
src/blog/gemini.md Normal file
View File

@ -0,0 +1,83 @@
Date: 2025-02-24
# Diving Deep into the World of Programming: A Journey of Logic and Creativity
Programming, in its essence, is the art and science of communicating with computers. It's about crafting a precise sequence of instructions, a "program," that dictates every step a machine should take. From the sleek applications on your smartphone to the intricate systems that manage global infrastructure, programming is the invisible hand shaping the technological world we inhabit. It's more than just lines of code; it's the engine of innovation.
## The Art of Problem Solving: Deconstructing the Complex
At its heart, programming is a powerful tool for problem-solving. It's the process of taking a complex challenge, dissecting it into smaller, more manageable components, and then translating those individual pieces into a language that the computer can comprehend. This demands not only logical reasoning and analytical thinking but also a spark of creativity to envision elegant and efficient solutions. It's a continuous cycle of ideation, implementation, testing, and refinement, a process that hones critical thinking skills and fosters a resilient mindset.
## Navigating the Landscape of Programming Languages: A Diverse Ecosystem
The world of programming languages is a vibrant and diverse ecosystem, each language possessing its own unique strengths, weaknesses, and intended applications. Think of them as different tools in a programmer's toolbox.
* **Python:** Often lauded as a beginner-friendly language, Python's clean syntax and readability make it an excellent entry point into the world of coding. Its versatility shines in web development, data science, and scripting.
```python
print("Hello, World!") # A classic Python greeting
```
* **Java:** A robust and platform-independent language, Java is a cornerstone of enterprise-level applications, Android development, and large-scale systems. Its "write once, run anywhere" philosophy has made it a popular choice for cross-platform development.
* **C++:** Renowned for its performance and control, C++ is often the language of choice for game development, system programming, and applications where speed is paramount. Its power comes with added complexity, demanding a deeper understanding of memory management.
* **JavaScript:** The language of the web, JavaScript empowers dynamic and interactive web pages. From simple animations to complex web applications, JavaScript breathes life into the user experience. Its role in front-end and increasingly back-end development makes it an essential skill for web developers.
This is just a glimpse into the vast array of programming languages. Others, like C#, Swift, Go, and Ruby, each cater to specific needs and domains. The selection of a language often hinges on the project's requirements, the programmer's familiarity, and the desired performance characteristics.
## Beyond the Code: The Impact of Programming
Learning to program is an investment that yields substantial returns. It unlocks a plethora of career opportunities, from crafting cutting-edge software to automating mundane tasks. But the benefits extend far beyond career prospects. Programming cultivates invaluable skills, including:
* **Critical Thinking:** Deconstructing problems and formulating logical solutions strengthens analytical abilities.
* **Problem-Solving:** The iterative nature of programming fosters resilience and a systematic approach to tackling challenges.
* **Creativity:** Designing elegant and efficient algorithms requires ingenuity and innovative thinking.
* **Attention to Detail:** The precision demanded by programming hones focus and meticulousness.
## Embarking on Your Programming Journey: A World of Possibilities
Whether your aspirations lie in building immersive games, designing intelligent systems, or simply understanding the technology that surrounds us, programming provides the tools to transform your ideas into reality. It's a journey of continuous learning, exploration, and discovery. Don't be intimidated by the initial complexity. Start with a language that resonates with you, explore online resources, join communities of fellow learners, and embrace the challenges. The world of programming awaits, ready to be shaped by your creativity and ingenuity. So, take the first step, dive into the code, and embark on your own programming adventure!
# Decoding the Matrix: A Deep Dive into the Multifaceted World of Programming
Programming, in its most fundamental form, is the intricate art and science of orchestrating communication with computational machines. It's the meticulous process of constructing a precisely ordered sequence of instructions, a "program," that meticulously dictates every granular step a computer should execute. From the intuitive applications gracing our mobile devices to the complex, interconnected systems underpinning global financial markets, programming is the invisible architect, the silent engine propelling the technological revolution that defines our era. It transcends mere lines of code; it's the very DNA of innovation, the catalyst for progress in the digital age.
## The Architect of Solutions: Deconstructing Complexity, Building Ingenuity
At its core, programming serves as a potent instrument for problem-solving. It's the intellectual endeavor of dissecting a seemingly insurmountable challenge, meticulously fragmenting it into smaller, digestible components, and subsequently translating these individual fragments into a language comprehensible by the computational mind. This process demands not only rigorous logical reasoning and incisive analytical thinking but also a spark of creative ingenuity to envision elegant and optimized solutions. It's an iterative, cyclical process of ideation, implementation, rigorous testing, and continuous refinement, a journey that hones critical thinking faculties and cultivates a resilient, adaptable mindset.
## Navigating the Labyrinth of Programming Languages: A Tapestry of Tools
The realm of programming languages is a dynamic, ever-evolving ecosystem, a vibrant tapestry woven with diverse languages, each possessing its own unique strengths, inherent weaknesses, and intended applications. Envision them as the specialized tools in a programmer's extensive toolkit, each designed for a specific purpose.
* **Python:** Frequently lauded as an ideal entry point for novice programmers, Python's clean, almost human-readable syntax and intuitive structure make it an excellent gateway into the world of coding. Its versatility shines brightly in web development, data science, machine learning, and scripting automation. Its extensive library ecosystem empowers developers to tackle complex tasks with ease.
```python
def factorial(n): # Demonstrating recursion in Python
if n == 0:
return 1
else:
return n * factorial(n-1)
print(factorial(5)) # Output: 120
```
* **Java:** A robust, platform-independent language, Java stands as a cornerstone of enterprise-grade applications, Android mobile development, and large-scale distributed systems. Its "write once, run anywhere" philosophy, facilitated by the Java Virtual Machine (JVM), has cemented its position as a popular choice for cross-platform development. Its object-oriented nature promotes modularity and code reusability.
* **C++:** Renowned for its raw performance, granular control, and low-level access, C++ often reigns supreme in game development, systems programming, high-frequency trading platforms, and applications where execution speed is paramount. Its power, however, comes with increased complexity, necessitating a deeper understanding of memory management, pointers, and object lifetimes.
* **JavaScript:** The undisputed lingua franca of the web, JavaScript empowers dynamic, interactive, and responsive web pages. From subtle animations to complex single-page applications (SPAs), JavaScript breathes life into the user experience. Its ubiquitous presence in both front-end and increasingly back-end development (Node.js) makes it an indispensable skill for modern web developers.
* **Rust:** A rising star in the systems programming world, Rust focuses on memory safety and concurrency without sacrificing performance. Its ownership and borrowing system ensures memory safety at compile time, eliminating many common bugs that plague C and C++ developers. This makes it ideal for building reliable and performant systems.
This is but a fleeting glimpse into the vast, ever-expanding universe of programming languages. Others, such as C#, Swift, Go, Kotlin, and Ruby, each cater to specific niches, domains, and paradigms. The selection of a particular language often hinges on the project's unique requirements, the programmer's individual familiarity and expertise, and the desired performance characteristics. Considerations like community support, available libraries, and tooling also play a significant role.
## Beyond the Lines of Code: The Profound Impact of Programming
Acquiring the skills of programming is an investment that yields substantial, long-lasting returns. It unlocks a plethora of career pathways, from crafting cutting-edge software and pioneering artificial intelligence to automating tedious processes and securing digital infrastructure. However, the benefits extend far beyond mere career advancement. Programming cultivates a range of invaluable cognitive skills:
* **Advanced Critical Thinking:** The process of deconstructing complex problems and formulating logical, algorithmic solutions strengthens analytical abilities and sharpens the mind.
* **Systematic Problem-Solving:** The iterative, experimental nature of programming fosters resilience, cultivates a systematic approach to tackling challenges, and promotes a growth mindset.
* **Creative Algorithmic Thinking:** Designing elegant, optimized, and efficient algorithms demands ingenuity, innovative thinking, and a knack for visualizing abstract processes.
* **Meticulous Attention to Detail:** The inherent precision demanded by programming hones focus, cultivates meticulousness, and emphasizes the importance of accuracy.
* **Abstraction and Generalization:** Identifying patterns and generalizing solutions to broader classes of problems fosters a deeper understanding of underlying principles.
## Embarking on Your Programming Odyssey: A Universe of Possibilities
Whether your aspirations lie in architecting immersive virtual worlds, designing intelligent autonomous systems, or simply gaining a deeper understanding of the technological fabric that surrounds us, programming provides the essential tools to translate your ideas into tangible realities. It's a continuous journey of learning, exploration, and discovery, a path that demands dedication and perseverance but rewards with profound intellectual satisfaction. Don't be daunted by the initial complexity; embrace the challenge. Begin with a language that resonates with your interests, explore the vast landscape of online resources, engage with vibrant communities of fellow learners, and persevere through the inevitable obstacles. The universe of programming awaits, ready to be shaped by your unique creativity, ingenuity, and passion. So, take the first step, delve into the code, and embark on your own programming odyssey!

View File

@ -1,3 +1,4 @@
Date: 2025-02-23
# H1 Tag
## H2 Tag
### H3 Tag
@ -5,6 +6,11 @@
##### H5 Tag
###### H6 Tag
| Header 0 | Header 1 | Header 2 | Header 3 |
|---|---|---|---|
|Cell 0 | Cell 1 | Cell 2 | This cell is really big so it will hopefully overflow........This cell is really big so it will hopefully overflow..........This cell is really big so it will hopefully overflow......... |
| Cell 3 | Cell 4 | Cell 5 | Cell 6 |
*This text is italic*
**This text is bold**
***This text is bold and italic***

View File

@ -15,10 +15,27 @@ export const load = async ({ url }: RequestEvent) => {
// Create the path
// ./src/[url].md
const blogPath = cwd.concat("/src", url.pathname, ".md");
const cleanPath = blogPath.replaceAll("%20", " ");
// Read the file and get the data
const data = readFileSync(blogPath, 'utf-8');
let data: string = "";
try {
data = readFileSync(cleanPath, 'utf-8');
} catch {
// Catch and return any errors
return {
post: {
content: "",
date: new Date(),
error: "Sorry, this post could not be found."
}
};
}
// Date: 2025-02-24 -> date object
const date: Date = new Date(data.split("\n")[0].split(":")[1].trim());
// Create a marked object that can parse the data
const marked = new Marked(
markedHighlight({
emptyLangClass: 'hljs',
@ -32,8 +49,11 @@ export const load = async ({ url }: RequestEvent) => {
return {
post: {
// Convert the markdown to HTML
content: marked.parse(data),
// Convert the markdown to HTML. Slice off the first line which is the date of publication.
// Any other meta data that needs to be cut can be removed by increasing the '1' in the slice.
content: marked.parse(data.split("\n").slice(1).join("\n")),
date: date,
error: null,
}
};
};

View File

@ -1,8 +1,19 @@
<script lang="ts">
import type { PageProps } from './$types';
let { data }: PageProps = $props();
console.log(`Post's date: ${data.post.date.toUTCString()}`);
</script>
<div class="blog-wrapper prose">
{#if data.post.error}
<main class="flex min-h-screen w-full flex-col items-center justify-center">
<h1 class="py-8 text-6xl font-semibold text-gray-300 italic opacity-30">404 - Not Found</h1>
<p class="text-sm text-gray-300 italic">
{data.post.error}
</p>
</main>
{:else}
<div class="blog-wrapper prose mx-[7.5%] my-[3%]">
{@html data.post.content}
</div>
</div>
{/if}