explaingit

phuocng/1loc

6,744MDXAudience · developerComplexity · 1/5Setup · easy

TLDR

A community-sourced collection of JavaScript one-liners, tiny single-line code snippets that each do something useful, browsable on an associated website built with Eleventy.

Mindmap

mindmap
  root((1loc))
    What it does
      JS one-liner snippets
      Community-sourced tips
    Content
      Single-line code
      Markdown files
      Browse on website
    Contributing
      Submit markdown file
      Add to contents folder
    Tech
      Eleventy static site
      MDX format
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Browse the collection to find a single line of JavaScript that solves a common task like checking if a value is an array or generating a random color.

USE CASE 2

Contribute your own useful JavaScript one-liner to the community by submitting a markdown file to the contents folder.

Tech stack

JavaScriptMDXEleventy

Getting it running

Difficulty · easy Time to first run · 5min

In plain English

This is a community collection of JavaScript one-liners: short snippets of code that accomplish something useful in a single line. The project is built around a website where visitors can browse and discover tips, and anyone can contribute by submitting a markdown file with their favorite single-line snippet. The README is sparse and does not describe the contents of the collection in detail. The repository stores each snippet as a markdown file in a contents folder, and the site appears to be built with Eleventy, a tool for generating static websites from those files. To see the actual snippets, browsing the repository's contents folder or visiting the associated website would give a better picture than the README alone.

Copy-paste prompts

Prompt 1
I want to contribute a JavaScript one-liner to the 1loc collection. Show me what a correctly formatted markdown snippet file should look like based on the contents folder structure.
Prompt 2
Give me 5 JavaScript one-liners for working with arrays that fit the 1loc style, short, specific, and copy-pastable with no dependencies.
Prompt 3
I'm building a static site with Eleventy similar to 1loc where each markdown file in a folder becomes its own page. Help me set up the basic Eleventy config to do that.
Open on GitHub → Explain another repo

← phuocng on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.