Digital Garden

Notes,
Quotes & Snippets

A collection of random thoughts, code snippets I always forget, and quotes that stuck with me. Basically, my external hard drive.

2024-12-15
"The best code is the code you don't write. Complexity is a liability, not an asset."
#philosophy#simplicity
— Unknown
2024-12-10

React Hook for Window Size

const useWindowSize = () => {
  const [size, setSize] = useState({ 
    width: window.innerWidth, 
    height: window.innerHeight 
  });
  
  useEffect(() => {
    const handleResize = () => {
      setSize({ 
        width: window.innerWidth, 
        height: window.innerHeight 
      });
    };
    
    window.addEventListener("resize", handleResize);
    return () => window.removeEventListener("resize", handleResize);
  }, []);
  
  return size;
};
#react#hooks#utils
2024-11-28

On Abstractions

We often build abstractions too early. I've started following the 'Rule of Three': don't abstract until you've copied and pasted the same code three times. Premature abstraction is the root of all evil (or at least, a lot of spaghetti code).

#engineering#refactoring
2024-11-20

Is Server Components really the future, or are we just reinventing PHP with extra steps? The boundaries between client and server are getting blurrier by the day.

Join the discussion
#nextjs#architecture
2024-11-15
"Simplicity is the ultimate sophistication."
#design#minimalism
— Leonardo da Vinci
2024-11-10

Tailwind Gradient Text

className="text-transparent bg-clip-text bg-gradient-to-r from-purple-400 to-pink-600"
#css#tailwind#ui
2024-11-05

Design Systems

A design system isn't just a component library. It's a shared language between designers and developers. If you don't have shared tokens, you don't have a system, you just have a UI kit.

#design-systems#collaboration
2024-10-30

Why is vertical centering in CSS still so hard to remember? flex items-center justify-center... grid place-items-center... margin: auto... pick your poison.

Join the discussion
#css#rant