1loc is an open-source GitHub repository that aggregates favorite JavaScript single-line code snippets into an Eleventy-powered static site, inviting community contributions through pull requests.
What is 1loc?
1loc is a community-driven collection of JavaScript one-line code snippets (LOC), developed and maintained by Nguyen Huu Phuoc. The repository accepts markdown files that each describe a single JavaScript one-liner, and builds a static site using Eleventy. The project's GitHub topics include eleventy, javascript-utils, js-tips, one-line-code, and tips-and-tricks, and it has earned 6,730 stars.
Key Features
- Single-line snippets — Every contribution is exactly one line of JavaScript that solves a specific coding task, as reflected in the javascript-utils and js-tips topics.
- Community contributions — The README invites developers to submit their favorite one-liner by creating a markdown file and placing it in the contents folder via a pull request.
- Eleventy static generation — The site is built with Eleventy, a static site generator, producing fast, lightweight pages.
- Open-source licensing — The entire repository is public on GitHub, so anyone can read, fork, and reuse the snippets.
- Plain markdown input — Each tip is authored as simple markdown, making contribution accessible without needing build tooling knowledge.
Who is it for?
- JavaScript developers — Discover concise solutions to common problems and learn shorter, cleverer ways to write JS.
- Code snippet collectors — Maintain a ready reference of one-liners to reuse in projects without re-searching the web.
- Open-source contributors — Share your own favorite line of code with a growing community and see it published on the site after a pull request is merged.
How does 1loc work?
The contribution flow is straightforward: create a markdown file describing your preferred JavaScript one-liner, add it to the contents folder, and submit a pull request. Once merged, the Eleventy build incorporates the new file into the static site, making it available to all visitors.
Use cases
- Learning terse JavaScript — Browse the growing list of one-liners to see how developers compress logic into a single line.
- Quick reference — Keep 1loc open as a lookup for common coding problems across everyday JavaScript tasks.
- Sharing knowledge — Submit your own one-liner and see it featured in a community-curated, Eleventy-generated collection.








