Copy-paste kepake.
Snippet kode singkat yang beneran dipake. Git, Docker, PostgreSQL, JS, Python, Vim. Cari, copy, paste.
css(10)
Center with Flexbox
Center any element horizontally and vertically
CSS Grid Two Columns
Simple two-column layout with CSS Grid
Custom Scrollbar Styling
Style your scrollbar for WebKit browsers
Custom Text Selection Color
Change the highlight color when selecting text
Fixed Aspect Ratio Box
Create a box with a fixed aspect ratio
Fluid Typography with clamp
Responsive font size that scales with viewport
Hide Scrollbar but Keep Scroll
Hide the scrollbar while keeping scroll functionality
Object Fit Cover Image
Make images fill a container without distortion
Smooth Scroll Behavior
Enable smooth scrolling for the entire page
Truncate Text with Ellipsis
Cut off long text with three dots
curl(5)
docker(8)
Build Image with Tag
Build a Docker image with a custom name
Clean Everything (Dangling + Stopped)
Remove stopped containers, dangling images, and unused networks
Copy File to Container
Copy a file from host into a running container
Enter a Running Container
Get a shell inside a running Docker container
List Running Containers
Show all currently running Docker containers
Remove All Docker Images
Delete every Docker image to free up disk space
Run Container with Volume
Mount a local directory into a container
View Container Logs (Follow)
Stream logs from a container in real-time
git(12)
Amend Last Commit Message
Change the message of your most recent commit
Cherry-Pick a Commit
Apply a specific commit from another branch
Create and Switch Branch
Create a new branch and switch to it in one command
Delete All Merged Branches
Clean up local branches that have been merged into main
Force Push Safely
Force push only if no one else has pushed in the meantime
Rebase onto Main
Rebase current branch onto latest main
Restore Deleted Tracked File
Recover a file you deleted but was tracked by git
Revert Last Commit (Keep Changes)
Undo the last commit but keep your changes in the staging area
Show What Changed in a Commit
View the diff of a specific commit
Stash Changes Temporarily
Save uncommitted changes and restore them later
Undo git add (Unstage Files)
Remove a file from staging without losing changes
View a File from Another Branch
See a file's content from a different branch without switching
javascript(10)
Capitalize First Letter
Capitalize the first character of a string
Copy to Clipboard
Copy text to the user's clipboard using the Clipboard API
Debounce a Function
Delay function execution until user stops typing
Deep Clone an Object
Deep copy an object (works for JSON-serializable data)
Flatten Nested Array
Flatten a deeply nested array
Format Number as Currency
Format a number as a localized currency string
Get Unique Array Values
Remove duplicates from an array
Group Array by Property
Group array items by a property value
Parse Query Params to Object
Convert URL query string to an object
Sleep / Pause Execution
Pause execution for a number of milliseconds using async/await
linux(8)
Count Lines in Files
Count total lines across all files in a directory
Create tar.gz Archive
Compress a directory into tar.gz
Disk Usage in Human Format
Show disk usage with readable sizes
Extract tar.gz Archive
Extract a compressed tar.gz file
Find Largest Files
Find the 10 largest files on disk
Grep Recursively
Search for a string in all files recursively
Kill Process on Port
Kill whatever is running on a specific port
Make File Executable
Give execute permission to a file
nginx(5)
nodejs(8)
Check if Directory Exists
Check if a path exists and is a directory
Fetch with Timeout
Add a timeout to fetch requests using AbortController
Get Current Directory Path
Get the directory of the currently running script
Read Environment Variable
Access environment variables in Node.js
Read File Synchronously
Read a file with fs.readFileSync
Safe JSON Parse
Parse JSON without try-catch crashing your app
Stream to String
Convert a readable stream to a string
Write File Synchronously
Write content to a file with fs.writeFileSync
npm(5)
postgres(8)
Create User and Database
Create a new PostgreSQL user and database
Describe Table Structure
Show columns, types, and constraints of a table
Export Table to CSV
Export a PostgreSQL table to a CSV file
Find Duplicate Rows
Find rows with duplicate values in a column
Kill a Running Query
Cancel a long-running PostgreSQL query by PID
List All Databases
Show all databases in your PostgreSQL server
List Table Sizes
Show all tables and their sizes, largest first
Reset Auto-Increment (Serial)
Reset the auto-increment counter to a specific value
python(8)
Dictionary with Default Value
Auto-create keys with a default value
Enumerate with Index
Loop through a list with both index and value
F-String Formatting
Format strings with variables using f-strings
Filter List with Comprehension
Filter a list using a conditional list comprehension
Read File Line by Line
Read a file line by line without loading it all into memory
Sort List of Dicts by Key
Sort a list of dictionaries by a specific key
Virtual Environment Setup
Create and activate a Python virtual environment
Zip Two Lists Together
Iterate over two lists in parallel
react(8)
Conditional Rendering (Short Circuit)
Render a component only if a condition is true
Forward Ref to Child Component
Pass a ref from parent to child component
Get Previous State Value
Access the previous state value in setState
Lazy Load a Component
Dynamically import a component to reduce bundle size
useCallback to Memoize Function
Prevent unnecessary re-renders by memoizing callbacks
useEffect Cleanup Function
Clean up subscriptions and timers on unmount
useMemo for Expensive Calculation
Cache the result of a computation between renders
useReducer for Complex State
Manage complex state transitions with reducer
redis(5)
regex(5)
typescript(10)
Make All Fields Optional
Make every property of a type optional
Omit Keys from Object Type
Create a type with specific keys removed
Pick Specific Keys from Type
Create a type with only selected keys
Readonly Array
Make an array immutable — no push, pop, or splice
Record Type for Key-Value
Create a typed dictionary/map object
Safe String to Number
Convert a string to number without NaN issues
Satisfies Operator (TS 4.9+)
Validate a type without widening it
Template Literal Types
Create types from string patterns
Type Async Function Return
Properly type the return of an async function
Type Guard Function
Check if a value is a specific type at runtime
vim(6)
Delete Entire Line
Delete the current line in vim
Indent Multiple Lines
Indent or outdent several lines at once
Jump to Line Number
Go to a specific line number in vim
Save and Quit
Save changes and exit vim
Search and Replace
Find and replace text across the entire file
Split Window
Split the vim window vertically or horizontally