Code Snippets Library - Ready-to-Use Code Templates
Manage and organize your code snippets for React, Python, CSS and more
React useLocalStorage Hook
Custom hook to manage localStorage with React state
javascript
const useLocalStorage = (key, initialValue) => {
const [storedValue, setStoredValue] = useState(() => {
try {
const item = window.localStorage.getItem(key);
return item ? JSON.parse(...react
hooks
localStorage
CSS Glassmorphism Card
Modern glass effect card with backdrop blur
css
.glass-card {
background: rgba(255, 255, 255, 0.05);
backdrop-filter: blur(16px);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 12px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);...css
glassmorphism
modern
Python API Request Handler
Robust API request wrapper with error handling
python
import requests
from typing import Optional, Dict, Any
class APIClient:
def __init__(self, base_url: str, timeout: int = 30):
self.base_url = base_url.rstrip('/')
self.timeout = t...python
api
requests