Skip to content
A command-line application for 30 seconds of code snippets
JavaScript Shell
Branch: develop
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Update README Oct 14, 2018
scripts ci(deploy): revert back to old repo url Oct 27, 2018
src refactor(eslint): format after eslint config update Oct 7, 2019
submodules fix(submodules): update snippets (build: 2374) Aug 12, 2019
test feat: default to view given empty command Aug 12, 2019
.babelrc.js chore: cleanup babelrc May 8, 2019
.editorconfig
.eslintignore ci(deploy): revert back to old repo url Oct 27, 2018
.eslintrc.json
.gitignore build: use hidden tmp directory May 8, 2019
.gitmodules Setup project in a robust way Oct 7, 2018
.importjs.js chore: update dependencies and add importjs config Nov 14, 2018
.npmrc style(project): use ~ as default save prefix Oct 20, 2018
.prettierignore style: exclude changelog from formatting Mar 12, 2019
.prettierrc.json
.releaserc.json
.travis.yml chore(build): remove buggy prettier-eslint Oct 7, 2019
CHANGELOG.md chore(release): 1.4.1 [skip ci] Aug 12, 2019
LICENSE Add project settings Oct 1, 2018
README.md feat: default to view given empty command Aug 12, 2019
jest.config.js
jsconfig.json
package-lock.json Build(deps-dev): bump @types/node from 12.11.0 to 12.11.1 Oct 16, 2019
package.json Build(deps-dev): bump rollup from 1.23.1 to 1.24.0 Oct 15, 2019
rollup.config.js refactor(eslint): format after eslint config update Oct 7, 2019

README.md

30s

A command-line application for 30 seconds of code snippets.

NPM build status coveralls dependabot status semantic-release license

Demo


Features

  • Written in JavaScript (ES6)
  • View, view by tag and search snippets
  • Show what you find necessary by picking a layout
  • Colorful output or JSON
  • Copy all code to clipboard
  • Automatically updates with new snippet changes
  • Works on Linux, Mac and Windows

Installation

Pick one of the following options to install the command-line application:

Option 1: NPM / Yarn

npm install -g 30s
yarn add -g 30s

Option 2: Source

$ git clone git@github.com:sQVe/30s.git
$ cd 30s/
$ npm install
$ node lib/index.js <command> <query>

Usage

Commands

Short version Long version Description
r random View random snippet
s search Fuzzy search (RegExp) snippets by id
t tag View snippets by tag
v view View snippet with id
* View snippet with id

Options

Short version Long version Description
-c --cp Copy snippet code to clipboard
-j --json Print output in JSON format
-l --layout Print output with specified layout (default: "itced")
-h --help Output usage information
Layout
Layout key Description
i Output snippet id
t Output snippet tags
c Output snippet code
e Output snippet examples
d Output snippet description

Examples

Example Description
30s head View snippet with id head
30s v head View snippet with id head
30s view head View snippet with id head
30s r View random snippet
30s random View random snippet
30s t array View snippets by tag array
30s tag array View snippets by tag array
30s s all Find all snippets with an id that contains all
30s search all Find all snippets with an id that contains all
30s view merge --cp View snippet with id merge and copy its code
30s view merge --json View snippet with id merge and output as JSON
30s search all --layout ce Find all snippets with an id that contains all and output code and example

Contributing

Bug reports & feature requests

Please use the issue tracker to report bugs or file feature requests.

Developing

Pull requests are more than welcome. Do the following to start helping out:

  1. Fork this repository to your own GitHub account and then clone it to your local device.
  2. Run npm install in the created directory to install all necessary dependencies.

Optional steps:

  1. Uninstall 30s if it's already installed: npm uninstall -g 30s
  2. Link it to the global module directory: npm link

Style guide & conventions

Try to follow functional programming best practices. Use pure functions and Ramda when possible.

Write commits following: Angular Commit Message Conventions. This enables us to automatically release new versions together with semantic-release on fix and feat commit types.

prettier and eslint-config-sqve (a config based on standardjs) enforces our styling and formatting. It runs automatically on pre-commit and is also checked for issues on Travis CI.

Roadmap

See the development board for a detailed development roadmap. Below are a short outline of important improvements:

  • Autocomplete with omelette
  • Replace commander with basic yargs and own logic

Thanks

A big thank you to the core team and all the contributers at 30-seconds-of-code for creating an awesome curated collection of snippets.

License

Creative Commons License
CC0 1.0 Universal
You can’t perform that action at this time.