Giter Club home page Giter Club logo

concode's Introduction

Concode

Gem Version Build Status Maintainability


Generate consistent-codenames from any string (Heroku style, aka Haiku).

This is a Ruby port of Python's codenamize.


Installation

$ gem install concode

Feature Highlights

  • Use as a Ruby library or from the command line
  • Generate heroku-style / docker-style consistent codenames from any string (e.g. IP address, git commit hash)
  • Control the number of words, and number of letters in each word
  • Compatibility with Python's codenamize (both libraries will generate the same codes given the same string)
  • Limitless combinations (over 1.7 million for 2 words, and 1.8 billion for 3 words)

Command Line Usage

$ concode --help

Usage:
  concode <string> [options]
  concode --random [options]
  concode --count [options]
  concode (-h|--help|-v|--version)

Options:
  -w, --words N        Number of words to generate
  -c, --chars N        Max characters per word
  -g, --glue CHAR      Word separator
  -C, --caps           Capitalize words
  -n, --count          Count possible combinations
  -r, --random         Generate a random code
  -h, --help           Show this message
  -v, --version        Show version

Examples

$ concode hello
plausible-term

$ concode hello --words 3
ancient-plausible-term

$ concode hello --words 3 --chars 3 --caps --glue ' '
Cut Red Bar

$ concode --random -w4
cruel-aggressive-cute-world

Library Usage

require 'concode'

# basic use:

generator = Concode::Generator.new
puts generator.generate 'something annoying'
# => annoyed-poem

# or, with all the options:

generator = Concode::Generator.new words: 3, chars: 4, capitalize: true, glue: ' '
puts generator.generate 'something annoying'
# => Wise Rude Boot

# get the available combinations with:

puts generator.word_count
# => 7402200

Credits

Thanks to Jose Juan Montes (@jjmontesl) for developing and documenting codenamize.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.