{"id":16852534,"url":"https://github.com/2called-chaos/usernamegen","last_synced_at":"2025-03-23T15:31:42.014Z","repository":{"id":24571370,"uuid":"27978911","full_name":"2called-chaos/usernamegen","owner":"2called-chaos","description":"Usernamegen - a not so serious name generator","archived":false,"fork":false,"pushed_at":"2022-08-01T14:47:01.000Z","size":41,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T21:54:38.233Z","etag":null,"topics":["gem","name-generation","rails","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/2called-chaos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-14T00:55:07.000Z","updated_at":"2025-02-06T04:16:23.000Z","dependencies_parsed_at":"2022-08-22T16:40:39.379Z","dependency_job_id":null,"html_url":"https://github.com/2called-chaos/usernamegen","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2called-chaos%2Fusernamegen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2called-chaos%2Fusernamegen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2called-chaos%2Fusernamegen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2called-chaos%2Fusernamegen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2called-chaos","download_url":"https://codeload.github.com/2called-chaos/usernamegen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245122899,"owners_count":20564401,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gem","name-generation","rails","ruby"],"created_at":"2024-10-13T13:47:38.066Z","updated_at":"2025-03-23T15:31:41.124Z","avatar_url":"https://github.com/2called-chaos.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Usernamegen - a not so serious name generator\n\n[![Gem Version](https://badge.fury.io/rb/usernamegen.svg)](http://badge.fury.io/rb/usernamegen)\n[![Build Status](https://github.com/2called-chaos/usernamegen/actions/workflows/spec.yml/badge.svg)](https://github.com/2called-chaos/usernamegen/actions/workflows/spec.yml)\n\nWe thought our users should be able to comment even when they haven't choose a username yet.\nTo make it easier to follow conversations we didn't want to show \"anonymous\" or some boring incrementing name á la \"guest 1234\".\n\nThis gem uses two lists (descriptive words and nouns) and multiplies them with each and another resulting in a list of mostly meaningful and often silly name combinations.\n\n**The current list generates at least 1,367,631 unique usernames**. Please help increasing the size by providing more words.\n\n## Example names\n\n  * Delicate Puppy\n  * Mysterious Wheatley\n  * Tough Goldfish\n  * Chemical Rabbit\n  * [surprise me](https://de.gamesplanet.com/namegen)\n\n\n## Installation\n\nRequires Ruby \u003e= 1.9.3\n\nSimple as:\n\n    $ gem install usernamegen\n\nOr list in your Gemfile\n\n    gem 'usernamegen'\n\n\n## Usage\n\nYou can use the generator class like so (also see Caching/Benchmark):\n\n```ruby\n# Assembles whole list each time (yielding more than 1 million strings, cache them!)\nUsernamegen.all\n\n# Samples one item from both lists and assembles them (fast)\nUsernamegen.one\n\n# Uses multiple `#one` calls to give you an array of names without having to take a subset of `#all`.\n# You may get duplicate names! This is just a shorthand as simple as `AMOUNT.times.map{ one }`.\nUsernamegen.some(10)\n\n# Assembles a list for a given thing (huge result set)\nUsernamegen.all_for_thing(\"thing\")\n\n# Assembles a list for a given description (huge result set)\nUsernamegen.all_for_desc(\"description\")\n```\n\nInitiating the class will instantly load the two text files into memory (as array). You can also use the instance approach if you have multiple calls to the generator.\n\n```ruby\ngenerator = Usernamegen.new(opts = {}, \u0026formatter)\ngenerator.one\ngenerator.all_for_thing\n```\n\n## Custom format\n\nYou can return usernames in your custom format at all methods. Just pass a block, e.g.:\n\n```ruby\nUsernamegen.one { |combination| combination.join(\"-\").downcase }\n=\u003e \"able-action\"\n```\n\nIf you use the instance approach you may also want to redefine the default format.\n\n```ruby\ngenerator = Usernamegen.new format: -\u003e(combination){ combination.join(\"-\").downcase }\n\n# or sugar version\ngenerator = Usernamegen.new { |combination| combination.join(\"-\").downcase }\n\ngenerator.one\n=\u003e \"malicious-expert\"\n```\n\n\n## Options\n\nThe generator class has a few options but except for the format option there is little reason for you to change them.\n\n```ruby\nUsernamegen.new({\n  # The default format (note that passing a block to #new will overwrite the hash option)\n  format: -\u003e(combination){ combination.join(\" \").titleize },\n\n  # This option only exists for testing\n  rng: ::SecureRandom.urlsafe_base64(128),\n\n  # You could point to different word lists here\n  descriptions: \"#{ROOT}/lib/usernamegen/descriptions.txt\",\n  things: \"#{ROOT}/lib/usernamegen/things.txt\",\n})\n```\n\n\n## Caching / Benchmark\n\nWhile the `#one` and `#some` methods are quite fast it's still advised to import the combinations to your database in a batch fashion opposed to generate single names on the fly.\n\nWe suggest a separate _Codename_ model and assign a free name to a user when he needs one (usually upon registration or first post). You can find an example ActiveRecord model + rake import tasks in the following gist.\n\n  * [» Benchmarks](https://gist.github.com/2called-chaos/a0ea619fdc7ef245719d)\n  * [» ActiveRecord model example and rake import task](https://gist.github.com/2called-chaos/46705324d913e4f9cc6b)\n\n\n## Testing\n\nJust `bundle` and invoke `rake`.\n\n## Contributing\n\n1. Fork it ( http://github.com/2called-chaos/usernamegen/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2called-chaos%2Fusernamegen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2called-chaos%2Fusernamegen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2called-chaos%2Fusernamegen/lists"}