{"id":13746745,"url":"https://github.com/thoughtbot/baccano","last_synced_at":"2025-05-09T07:32:15.374Z","repository":{"id":36867396,"uuid":"41174366","full_name":"thoughtbot/baccano","owner":"thoughtbot","description":"[no longer maintained]","archived":true,"fork":false,"pushed_at":"2020-04-13T17:12:21.000Z","size":96,"stargazers_count":73,"open_issues_count":0,"forks_count":6,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-05-22T19:30:20.693Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","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/thoughtbot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-21T19:43:36.000Z","updated_at":"2024-05-11T09:38:40.000Z","dependencies_parsed_at":"2022-09-08T00:21:04.415Z","dependency_job_id":null,"html_url":"https://github.com/thoughtbot/baccano","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoughtbot%2Fbaccano","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoughtbot%2Fbaccano/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoughtbot%2Fbaccano/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoughtbot%2Fbaccano/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thoughtbot","download_url":"https://codeload.github.com/thoughtbot/baccano/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253209454,"owners_count":21871655,"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":[],"created_at":"2024-08-03T06:01:00.303Z","updated_at":"2025-05-09T07:32:15.107Z","avatar_url":"https://github.com/thoughtbot.png","language":"HTML","funding_links":[],"categories":["HTML"],"sub_categories":[],"readme":"# Baccano\n\n**This service is no longer maintained and will be taken offline on July 1, 2020.**\n\n1. User profile images\n2. `_____`\n3. profit?\n\n## Architecture\n\nThe (SVG) template for the base avatar is in `views/index.erb`. It interpolates\nvalues from the `Avatar` Ruby object found in `avatar.rb`. There are two types\nof values on `Avatar` that might be used in the template:\n\n1. Attributes of existing elements in the template (e.g. shirt color)\n2. SVG partials that can be overlayed on top of the base template (e.g.\n   sunglasses)\n\nThe `Avatar` object does not contain any logic, it is simply a data object that\ncontains all of the variables we need in the template.\n\nWe use a separate object `Rng` to generate `Avatar` objects with random values.\nIt can be initialized with a seed to guarantee the same results. If no seed is\ngiven, a random seed will automatically be used.\n\n## Adding new random attributes\n\nTo add a new random attribute (such as eye color), do the following:\n\n1. Add the new attribute to the `Avatar` class\n2. Interpolate the new attribute in the correct place in `views/index.erb`\n3. Add a function that generates a random version of your attribute to `Rng`\n   (e.g. `Rng#eye_color`)\n4. Use that function when randomly generating an avatar in `Rng#avatar`\n\n## Adding a new augmentation\n\nTo add a new augmentation (such as beards), do the following:\n\n1. Create a folder for your augmentation under `views/` (e.g. `views/beard`)\n2. Put one or more variations in this folder. These are SVG files but should\n   have a `.erb` extension.\n3. Add the new attribute to the `Avatar` class.\n4. Render the partial returned by that attribute in `views/index.erb`. (e.g.\n   `\u003c%= erb @avatar.beard %\u003e`)\n5. Add a function to `Rng` that returns a random partial for your new attribute.\n   (e.g. `Rng#beard`) Take advantage of the `Rng#attribute_partial` function to\n   pick a random partial from a given directory. (e.g. `attribute_partial(\"beard\")`\n   will return a random partial from the `views/beard` directory)\n6. Use the function created in (5) when randomly generating an avatar in\n   `Rng#avatar`\n\n## Adding a new variant to an existing augmentation\n\nSay you want to add a new type of sunglasses. Do the following:\n\n1. Add the SVG file of your new variant to the existing `views/glasses` folder,\n   saved with a `.erb` extension.\n2. Profit!!!\n\n## Weighted defaults\n\nFor many random attributes, we want to use a default value X% of the time.\nThe `Rng#percentage` allows us to do this. For example:\n\n```ruby\n  def glasses\n    percentage(60, \"\") { attribute_partial(\"glasses\") }\n  end\n```\n\nwill return default to empty string (`\"\"`) 60% of the time, and otherwise it\nwill pick a random partial from the `views/glasses` directory.\n\nUsing this function when generating an avatar means that 60% of avatars will\nhave no glasses while the remaining 40% will have a random pair of glasses\npulled from the SVGs in the `view/glasses` directory.\n\n## Viewing your work\n\nTo view your work locally:\n\n1. Start a server with `foreman start`\n2. Visit `localhost:5000/random`\n3. Keep refreshing the page to see a new random avatar\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthoughtbot%2Fbaccano","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthoughtbot%2Fbaccano","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthoughtbot%2Fbaccano/lists"}