Category: Uncategorised

  • Inside the Code: A Developer’s Guide to My Node.js Blog

    Inside the Code: A Developer’s Guide to My Node.js Blog

    Inside the Code: A Developer’s Guide to My Node.js Blog

    This blog isn’t powered by WordPress, Ghost, or any third-party CMS. I built it using Node.jsExpressMongoDB, and EJS all from scratch.

    Here’s a peek under the hood at how it works.


    🛠️ Tech Stack Overview

    • Node.js + Express for the server and routing
    • MongoDB (with Mongoose) for storing blog posts
    • EJS for rendering dynamic templates
    • Static assets in /public for CSS, JS, and images

    📁 Project Structure

    ├── server.js
    ├── routes/
    │   └── articles.js
    ├── views/
    │   └── articles/
    │       ├── index.ejs
    │       └── show.ejs
    ├── models/
    │   └── article.js
    ├── public/
    │   └── scripts/
    │       └── NumberFormatter.js

    🔁 The Main Flow

    1. Home Route (/)

    In server.js:

    app.get('/', async (req, res) => {
      const articles = await Article.find().sort({ createdAt: 'desc' });
      res.render('articles/index', {
        articles,
        formatWithAbbreviation
      });
    });
    • Fetches all articles from MongoDB
    • Sorts them by creation date (newest first)
    • Passes them into an EJS template along with a number formatter

    2. Article Routes (/articles)

    In routes/articles.js, I handle:

    • New post creation
    • Editing
    • Deletion
    • Viewing individual posts

    EJS templates handle the views, and Mongoose manages the database logic.


    🧮 Formatting Numbers Smartly

    I wrote a tiny utility: NumberFormatter.js.

    // Example usage
    formatWithAbbreviation(12400); // "12.4K"

    This keeps the blog clean and modern, especially for stats like views or likes.


    🎨 Static Assets

    app.use('/public', express.static('./public'));

    All my CSS, JS, and media live in /public, and Express serves them directly.


    🔐 Dev-Friendly Extras

    • Method Override to allow PUT/DELETE in HTML forms
    • Environment variables for database config
    • Middleware for parsing form data

    🧠 Final Thoughts

    This blog isn’t just a writing platform—it’s a playground for learning full-stack web development. I control every part of the stack, from server logic to templating and deployment.

    If you’re thinking of building your own blog from scratch, I say go for it. It’s the best way to truly understand how the web works.

  • The Silent Power of Micro-Habits: How Tiny Actions Create Massive Results

    The Silent Power of Micro-Habits: How Tiny Actions Create Massive Results

    Introduction

    Big goals often feel overwhelming. Whether it’s losing weight, writing a book, or learning a new language, the journey seems daunting at the start. But what if the key to success lies not in giant leaps—but in tiny, consistent actions? Welcome to the world of micro-habits.


    What Are Micro-Habits?

    micro-habit is a small, specific behavior that takes minimal effort and time to complete. Think: doing one push-up, writing one sentence, or drinking one glass of water.

    “Micro-habits are so small, you can’t fail.”
    — B.J. Fogg, author of Tiny Habits

    The beauty of micro-habits lies in their simplicity. They remove friction and resistance, making it easy to start and—more importantly—to stay consistent.


    Why Micro-Habits Work

    1. Reduce Willpower Drain
      Unlike massive behavior changes, micro-habits don’t require huge motivation or discipline.
    2. Trigger Positive Momentum
      One push-up often becomes five. One sentence becomes a paragraph. Tiny actions build confidence and forward momentum.
    3. Compound Over Time
      Just like investing, small gains accumulate. A 1% improvement daily compounds into massive change.

    How to Build Micro-Habits

    Here’s a 4-step guide to start:

    1. Anchor to an Existing Habit

    Link your new micro-habit to something you already do.
    Example: “After I brush my teeth, I’ll drink a glass of water.”

    2. Make It Stupid-Small

    Start absurdly easy. If it’s too hard to fail, you’re more likely to succeed.

    3. Celebrate Immediately

    Reinforce the habit by celebrating—even with a smile or fist-pump.

    4. Be Consistent, Not Perfect

    The goal is repetition, not perfection. Missing one day is fine. Two days in a row? Dangerous.


    Real-Life Examples

    • Fitness: One push-up before bed
    • Writing: One sentence after lunch
    • Learning: One new vocabulary word daily
    • Finance: Check account balance every morning

    Final Thoughts

    Massive change doesn’t require massive action. It requires consistency. Micro-habits are the secret weapon of high performers, creative thinkers, and resilient individuals.

    Start today. Start small. Stay consistent.
    Big results will follow.


    “You do not rise to the level of your goals. You fall to the level of your systems.”
    — James Clear, Atomic Habits

  • Ozzy Osbourne: The Prince of Darkness Who Redefined Rock

    Ozzy Osbourne: The Prince of Darkness Who Redefined Rock

    Introduction

    From Black Sabbath to solo stardom, Ozzy Osbourne wasn’t just a rock icon—he was heavy metal. Dubbed the “Prince of Darkness,” his career spanned over five decades of chaos, creativity, and cultural impact.


    Early Life

    • Full Name: John Michael Osbourne
    • Born: December 3, 1948, in Birmingham, England
    • Raised in a working-class family, he struggled with dyslexia and poverty but found purpose in music—especially after hearing The Beatles.

    Black Sabbath: The Birth of Metal

    • In 1968, Ozzy co-founded Black Sabbath, considered the first heavy metal band.
    • Albums like:
      • Black Sabbath (1970)
      • Paranoid (1970)
      • Master of Reality (1971)
    • Songs like “Iron Man,” “War Pigs,” and “Paranoid” became genre-defining.

    He was fired in 1979 due to drug and alcohol issues—but that wasn’t the end.


    Solo Success & Reinvention

    ⚡️ Solo Breakthrough:

    • Blizzard of Ozz (1980): “Crazy Train,” “Mr. Crowley”
    • Diary of a Madman (1981): cemented his solo legend
    • Collaborated with legendary guitarist Randy Rhoads (who died in 1982)

    📀 Other Solo Highlights:

    • No More Tears (1991): “Mama, I’m Coming Home”
    • Ordinary Man (2020): with Elton John & Post Malone
    • Patient Number 9 (2022): Grammy-winning

    Public Persona & Pop Culture

    • Bit the head off a bat onstage in 1982 (accidentally!)
    • Starred in The Osbournes (2002–2005) — the first viral reality TV family
    • Created Ozzfest, a touring metal festival that launched bands like Slipknot and System of a Down

    Health Battles

    • Diagnosed with Parkinson’s Disease (made public in 2020)
    • Multiple spinal surgeries from 2019 to 2024
    • Retired from touring but never stopped recording or performing when he could

    Final Performance: July 2025

    • Farewell show titled Back to the Beginning in Birmingham
    • Black Sabbath reunited for a final benefit concert
    • Ozzy performed seated but defiant—fans, family, and legends joined
    • Proceeds went to Parkinson’s research and children’s charities

    Death & Legacy

    • Died: July 22, 2025, at age 76
    • Tributes from Tony Iommi, Alice Cooper, Metallica, and millions of fans
    • Inducted into the Rock & Roll Hall of Fame (twice):
      • With Black Sabbath (2006)
      • As a solo artist (2024)

    Influence & Honors

    • Over 100 million albums sold
    • Influenced artists across metal, rock, punk, and pop
    • Known for blending menace with humor and honesty
    • Final recording: “Gods of Rock n Roll” (2025) — a dramatic orchestral single

    Key Albums

    YearAlbumNotes
    1970Paranoid (Sabbath)Metal masterpiece
    1980Blizzard of OzzSolo debut, “Crazy Train”
    1991No More TearsGrammy-winning
    2020Ordinary ManComeback with Elton John
    2022Patient Number 9Grammy for Best Rock Album
    2025Gods of Rock n RollFinal track before death

    Final Thoughts

    Ozzy Osbourne was loud, flawed, brilliant—and unforgettable. He helped invent a genre, survived fame’s darkest corners, and left the stage on his terms.

    “I’m not a role model… I’m a rock and roll survivor.”
    — Ozzy Osbourne

    Rest in power, Prince of Darkness.