- Project Description: Collaborative platform that enables organisations to manage projects, contributions, solutions, and voting mechanisms with AI-driven analysis
- Date Created: September 2025
- Last Updated: September 2025
This guide demonstrates how to programmatically duplicate files with new names based on filename patterns using Zsh scripting.
Common use case: You're working with a codebase using .tsx files (React TypeScript) and need to quickly scaffold variants of each component — like *-skeleton.tsx and *-fallback.tsx files.
| // Based on Theo - t3․gg suggestion and ZOD | |
| // Youtube https://www.youtube.com/watch?v=Y6jT-IkV0VM&t=538s | |
| // and gist https://gist.github.com/t3dotgg/a486c4ae66d32bf17c09c73609dacc5b | |
| type Success<T> = { | |
| success: true | |
| data: T | |
| error?: never | |
| } |
Form handling in React can quickly become verbose and repetitive. The Dynamic Property Name pattern (sometimes called the "single handler pattern") elegantly solves this problem by combining several modern JavaScript features. Let me walk you through several iterations of this powerful pattern, its benefits, and some enhancements.
- DRY Code: A single handler function handles all input changes, eliminating redundant code.
- Self-Documenting: The input's name attribute directly corresponds to the state property, making the relationship clear.
- Scalability: Adding new form fields requires minimal code changes - just add a new input with the appropriate name.
- Maintainability: Changes to validation or processing logic happen in one place.
The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.
This means you have the following choices:
- Use ESM yourself. (preferred)
Useimport foo from 'foo'instead ofconst foo = require('foo')to import the package. You also need to put"type": "module"in your package.json and more. Follow the below guide. - If the package is used in an async context, you could use
await import(…)from CommonJS instead ofrequire(…). - Stay on the existing version of the package until you can move to ESM.
Reverting changes in Git traditionally required using git checkout to restore files or git reset to adjust the branch HEAD. However, both commands carried risks if misused: git reset could shift the branch HEAD, while git checkout could either switch branches or load a different commit, potentially disrupting the current branch state.
git restore main.jsG'day mate! Welcome to the most fair dinkum date formatting library this side of the Southern Hemisphere!
Ever needed to format your dates in proper Australian style but got lost in the outback of date formatting? No worries! This little beauty's got you covered with all the date formats you'll ever need in the land down under.
| /** | |
| * A builder class for manipulating JavaScript Date objects in a chainable way. | |
| * @class | |
| * @example | |
| * const builder = new DateBuilder(); | |
| * const nextWeek = builder | |
| * .addDays(7) | |
| * .build(); | |
| * | |
| * @example |
Because sometimes your promises are buried deeper than your ex's Instagram photos. This utility helps you resolve them all, no matter where they're hiding! 🕵️♂️
- Resolves promises in deeply nested objects and arrays
- Works just like
Promise.allbut for objects (because objects deserve love too!) - Handles arrays, objects, and any combination thereof
- Preserves your object structure (unlike your New Year's resolutions)
The tryCatch utility function provides several significant advantages over traditional try-catch blocks and Promise chains. Here's why you might want to consider this pattern:
Traditional error handling requires different approaches for synchronous and asynchronous code:
// Traditional approach - try catch