Use Cases & Examples
See how developers use GhostPaste to share code securely in real-world scenarios
Code Review Snippets
Share specific code sections for review without exposing entire codebases
javascript// Authentication middleware
function authenticate(req, res, next) {
const token = req.headers.authorization?.split(" ")[1];
if (!token) {
return res.status(401).json({ error: "No token" });
}
try {
const decoded = jwt.verify(token, process.env.SECRET);
req.user = decoded;
next();
} catch (error) {
res.status(403).json({ error: "Invalid token" });
}
}Best for: Getting feedback on specific implementations
API Configuration
Securely share API endpoints and configuration with team members
json{
"api": {
"baseUrl": "https://api.staging.example.com",
"version": "v2",
"endpoints": {
"auth": "/auth/login",
"users": "/users",
"products": "/products"
},
"headers": {
"X-API-Version": "2.0",
"X-Client-Id": "mobile-app-staging"
}
}
}Best for: Sharing environment configs without committing to repo
Interview Code Challenge
Send coding challenges and receive solutions securely
python"""
Challenge: Implement a function that finds the longest
palindromic substring in a given string.
Example:
Input: "babad"
Output: "bab" or "aba"
Input: "cbbd"
Output: "bb"
Constraints:
- 1 <= s.length <= 1000
- s consists of only lowercase English letters
"""
def longest_palindrome(s: str) -> str:
# Your implementation here
passBest for: Technical interviews and coding assessments
Bug Report with Code
Share problematic code snippets when reporting bugs
javascript// BUG: Memory leak in event listener
class DataGrid extends Component {
componentDidMount() {
// This listener is never removed!
window.addEventListener("resize", this.handleResize);
// Fetching data in a loop without cleanup
this.interval = setInterval(() => {
fetchData().then(data => {
this.setState({ data: [...this.state.data, ...data] });
});
}, 1000);
}
handleResize = () => {
console.log("Resizing...");
}
// Missing componentWillUnmount cleanup!
}Best for: Bug reports with reproduction code
Database Migrations
Share SQL migrations or schema changes for review
sql-- Migration: Add user preferences table
BEGIN TRANSACTION;
CREATE TABLE user_preferences (
id SERIAL PRIMARY KEY,
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
theme VARCHAR(20) DEFAULT "light",
notifications_enabled BOOLEAN DEFAULT true,
language VARCHAR(10) DEFAULT "en",
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX idx_user_preferences_user_id ON user_preferences(user_id);
-- Add trigger for updated_at
CREATE TRIGGER update_user_preferences_updated_at
BEFORE UPDATE ON user_preferences
FOR EACH ROW
EXECUTE FUNCTION update_updated_at_column();
COMMIT;Best for: Database schema reviews before deployment
CSS Design Tokens
Share design system variables and theme configurations
css:root {
/* Colors */
--primary: #6366f1;
--primary-hover: #4f46e5;
--secondary: #8b5cf6;
--success: #10b981;
--warning: #f59e0b;
--error: #ef4444;
/* Spacing */
--space-xs: 0.25rem;
--space-sm: 0.5rem;
--space-md: 1rem;
--space-lg: 1.5rem;
--space-xl: 2rem;
/* Typography */
--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
--font-mono: "SF Mono", Monaco, Consolas, monospace;
/* Shadows */
--shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}Best for: Sharing design tokens with developers
Shell Scripts
Share deployment or automation scripts securely
bash#!/bin/bash
# Deployment script for production
set -e # Exit on error
echo "๐ Starting deployment..."
# Check environment
if [ "$NODE_ENV" != "production" ]; then
echo "โ Error: NODE_ENV must be 'production'"
exit 1
fi
# Build the application
echo "๐ฆ Building application..."
npm run build
# Run tests
echo "๐งช Running tests..."
npm test
# Deploy to server
echo "๐ค Deploying to production..."
rsync -avz --delete ./dist/ user@server:/var/www/app/
# Restart services
echo "๐ Restarting services..."
ssh user@server "sudo systemctl restart nginx && sudo systemctl restart app"
echo "โ
Deployment complete!"Best for: Sharing deployment scripts with DevOps team
Error Stack Traces
Share error logs and stack traces for debugging
textTypeError: Cannot read properties of undefined (reading "map")
at ProfileList (ProfileList.tsx:45:23)
at renderWithHooks (react-dom.development.js:14985:18)
at updateFunctionComponent (react-dom.development.js:17356:20)
at beginWork (react-dom.development.js:19063:16)
at HTMLUnknownElement.callCallback (react-dom.development.js:3945:14)
at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:16)
Component Stack:
in ProfileList (at Dashboard.tsx:128)
in div (at Dashboard.tsx:125)
in Dashboard (at App.tsx:45)
in Route (at App.tsx:44)
in Switch (at App.tsx:41)
in Router (at App.tsx:40)
in App (at src/index.tsx:18)Best for: Debugging production errors with team
Best Practices by Use Case
Public Sharing
- โข Remove sensitive data
- โข Use longer expiry times
- โข No production secrets
- โข Sanitize file paths
Team Sharing
- โข Set appropriate expiry
- โข Use passwords for editing
- โข Share via secure channels
- โข Document the context
Sensitive Data
- โข Use one-time view
- โข Set 1-hour expiry
- โข Verify recipient first
- โข Never post publicly
Ready to Share Your Code Securely?
Join thousands of developers who trust GhostPaste for secure code sharing. No account needed, just paste and go.