whatisgithub

What is 1loc?

phuocng/1loc — explained in plain English

Analysis updated 2026-06-24

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

In one sentence

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

What do people build with it?

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.

What is it built with?

JavaScriptMDXEleventy

How does it compare?

phuocng/1locgetbem/getbem.github.iocloudflare/cloudflare-docs
Stars6,7445,7474,715
LanguageMDXMDXMDX
Setup difficultyeasyeasyeasy
Complexity1/51/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

So what is it?

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.

Frequently asked questions

What is 1loc?

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.

What language is 1loc written in?

Mainly MDX. The stack also includes JavaScript, MDX, Eleventy.

How hard is 1loc to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is 1loc for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.