Welcome to my blog! This is my space for writing about code, technology, and ideas.

What to Expect

I’ll be posting about:

  • Code: Deep dives into interesting problems and solutions
  • Tools: Reviews and workflows that make development better
  • Ideas: Thoughts on technology and software development

Code Samples

Here’s what code looks like on this blog. The syntax highlighting uses the Tokyo Night color scheme.

JavaScript

const greeting = (name) => {
  return `Hello, ${name}!`;
};

// Async example
async function fetchData(url) {
  try {
    const response = await fetch(url);
    const data = await response.json();
    return data;
  } catch (error) {
    console.error('Failed to fetch:', error);
    throw error;
  }
}

Python

from dataclasses import dataclass
from typing import Optional

@dataclass
class BlogPost:
    title: str
    content: str
    tags: list[str]
    published: bool = False

    def publish(self) -> None:
        """Mark the post as published."""
        self.published = True
        print(f"Published: {self.title}")

# Usage
post = BlogPost(
    title="Hello World",
    content="Welcome to my blog!",
    tags=["meta", "introduction"]
)
post.publish()

Go

package main

import (
	"fmt"
	"net/http"
)

func handler(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "Hello, World!")
}

func main() {
	http.HandleFunc("/", handler)
	fmt.Println("Server starting on :8080")
	http.ListenAndServe(":8080", nil)
}

Rust

use std::collections::HashMap;

#[derive(Debug)]
struct Config {
    name: String,
    values: HashMap<String, i32>,
}

impl Config {
    fn new(name: &str) -> Self {
        Config {
            name: name.to_string(),
            values: HashMap::new(),
        }
    }

    fn set(&mut self, key: &str, value: i32) {
        self.values.insert(key.to_string(), value);
    }

    fn get(&self, key: &str) -> Option<&i32> {
        self.values.get(key)
    }
}

fn main() {
    let mut config = Config::new("app");
    config.set("timeout", 30);
    config.set("retries", 3);

    println!("{:?}", config);

    if let Some(timeout) = config.get("timeout") {
        println!("Timeout is set to: {}", timeout);
    }
}

TypeScript

interface User {
  id: number;
  name: string;
  email: string;
  roles: string[];
}

type CreateUserInput = Omit<User, 'id'>;

class UserService {
  private users: Map<number, User> = new Map();
  private nextId = 1;

  create(input: CreateUserInput): User {
    const user: User = {
      id: this.nextId++,
      ...input,
    };
    this.users.set(user.id, user);
    return user;
  }

  findById(id: number): User | undefined {
    return this.users.get(id);
  }

  hasRole(user: User, role: string): boolean {
    return user.roles.includes(role);
  }
}

// Usage
const service = new UserService();
const admin = service.create({
  name: 'Admin User',
  email: 'admin@example.com',
  roles: ['admin', 'user'],
});

console.log(`Created user: ${admin.name}`);

Inline Code

You can also use inline code for small snippets like variable names or short commands like npm install.

Blockquotes

The best code is no code at all. Every new line of code you willingly bring into the world is code that has to be debugged, code that has to be read and understood.

— Jeff Atwood

Lists

Things I enjoy:

  1. Writing clean, readable code
  2. Learning new technologies
  3. Sharing knowledge with others

That’s it for now. Stay tuned for more posts!