Snippetly
HomeBrowseCreate
© 2025 Snippetly. All rights reserved.

Browse Snippets

34 snippets
Create
Sort by:

Timer Context Manager

A Python context manager that times how long a block of code takes to run. Helpful for measuring performance of scripts...

pythonperformance
Python
0
Jul 8
View snippet →

FastAPI GET Endpoint

A simple example of how to create a GET route using FastAPI. FastAPI is a modern, fast (high-performance) Python web fra...

pythonapifastapi
Python
0
Jul 8
View snippet →

Basic HTTP Server

Minimal HTTP server in Go using net/http. Good for testing routes or building simple APIs.

gowebserver
Go
0
Jul 8
View snippet →

React Error Boundary Component

A React component that catches JavaScript errors in its child component tree and displays a fallback UI instead of crash...

reacterrorsbest-practices
TypeScript
0
Jul 8
View snippet →

Dark Mode Toggle Hook

A custom React hook to toggle light/dark mode and persist the preference to localStorage. Note: the app must define ligh...

reacthooksui
TypeScript
0
Jul 8
View snippet →

useCopyToClipboard Hook

A React custom hook that copies text to the clipboard and sets a state to provide user feedback. Useful for buttons that...

reacthooksclipboard
TypeScript
0
Jul 8
View snippet →

Throttle Function

Ensures a function is only called at most once every X milliseconds. Great for controlling scroll handlers and improving...

utilitiesperformance
JavaScript
0
Jul 8
View snippet →

Debounce Function

Prevents a function from firing too frequently by waiting for a pause before calling it. Commonly used to optimize input...

utilitiesperformance
JavaScript
0
Jul 8
View snippet →

Sleep / Delay Promise

A lightweight utility function for adding delays in async JavaScript/TypeScript code. Commonly used for testing and retr...

utilitiesasync
JavaScript
0
Jul 8
View snippet →

Memoize Function

Caches results of expensive function calls to improve performance when the same input is provided repeatedly. Example: m...

performanceutilities
JavaScript
0
Jul 8
View snippet →
PreviousPage 2 of 2