Skip to content

Instantly share code, notes, and snippets.

View davidon's full-sized avatar
💯

William [...W->D] Duan davidon

💯
  • W.W.D - Whizz Web Development
  • Melbourne
View GitHub Profile
@davidon
davidon / FrontEndKnowledgeBase.md
Last active March 10, 2026 12:55
Front End Knowledge Base — Dev Notes & Q&A (Web, JS, Git, Tools)
@davidon
davidon / NullObjectPattern.md
Last active March 30, 2026 13:40
Null Object Pattern in PHP

Null Object Pattern in PHP

Overview

The Null Object pattern replaces null return values with a special "do-nothing" object that shares the same interface as the real object. This eliminates the need for null checks at every call site and prevents "Call to a member function on null" fatal errors.

When to use it

@davidon
davidon / Git-Worktree.md
Created March 30, 2026 13:37
Git Worktree Guide

Frequently Used Git Worktree Commands

Basic Operations

git worktree add <path> <branch>         # Create worktree for a branch that already exists in the repo
git worktree add -b <new-branch> <path>  # Create worktree with new branch
git worktree list                        # List all worktrees
git worktree remove <path>               # Remove a worktree