A community-built library of useful, reusable code snippets in every language.
Copy, paste, and build faster. Contribute yours and help others.
A growing collection of copy-paste-ready code snippets organized by language. Each snippet solves a real problem, is well-commented, and ready to drop into your project.
Why contribute here?
- Each snippet is a single file -- contribute one in under 10 minutes
- Perfect for first-time contributors
- Your snippet helps thousands of developers searching for solutions
- Great way to document patterns you use every day
| Language | Folder | Examples |
|---|---|---|
| Python | snippets/python/ |
API requests, data parsing, automation |
| JavaScript | snippets/javascript/ |
DOM utilities, async patterns, performance |
| HTML/CSS | snippets/html-css/ |
Responsive layouts, animations, components |
| Bash | snippets/bash/ |
System monitoring, file ops, deployment |
| Go | snippets/go/ |
HTTP servers, concurrency patterns |
| Rust | snippets/rust/ |
Error handling, CLI tools |
| Java | snippets/java/ |
Collections, streams, multithreading |
| C++ | snippets/cpp/ |
STL patterns, algorithms |
Your language not listed? Create a new folder under snippets/ and submit a PR.
- Fork this repository
- Navigate to
snippets/your-language/ - Create your snippet with a descriptive filename:
debounce-function.js - Follow the snippet template (below)
- Submit a PR
# Title: Read CSV File to Dictionary
# Description: Reads a CSV file and returns a list of dictionaries
# Author: @YourUsername
# Tags: csv, file, data, parsing
# Usage: rows = read_csv("data.csv")
import csv
def read_csv(filepath):
"""Read a CSV file and return rows as a list of dictionaries."""
with open(filepath, "r") as f:
reader = csv.DictReader(f)
return list(reader)
# Example usage
if __name__ == "__main__":
data = read_csv("example.csv")
for row in data:
print(row)- One concept per file -- keep snippets focused
- Include comments -- explain what and why
- Add usage examples -- show how to use the snippet
- Use descriptive filenames --
debounce-function.jsnotutil.js
Need inspiration? Here are snippets the community needs:
| Language | Ideas |
|---|---|
| Python | Email sender, PDF generator, web scraper, env loader |
| JavaScript | Local storage wrapper, form validator, infinite scroll, dark mode |
| HTML/CSS | Glassmorphism card, responsive navbar, loading spinner, tooltip |
| Bash | Git hooks, backup script, log rotator, health check |
Part of the Jaidevstudio open-source community