{"id":22543298,"url":"https://github.com/sudara/sometimes","last_synced_at":"2025-08-20T06:31:59.324Z","repository":{"id":6597206,"uuid":"7840138","full_name":"sudara/sometimes","owner":"sudara","description":"A few hacks n' helpers to make your code more fun and unpredictable.","archived":false,"fork":false,"pushed_at":"2021-02-12T17:17:01.000Z","size":48,"stargazers_count":200,"open_issues_count":1,"forks_count":11,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-12-07T13:16:51.529Z","etag":null,"topics":["random","ruby"],"latest_commit_sha":null,"homepage":"","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/sudara.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":"2013-01-26T16:23:52.000Z","updated_at":"2024-06-25T17:12:09.000Z","dependencies_parsed_at":"2022-09-11T02:31:28.336Z","dependency_job_id":null,"html_url":"https://github.com/sudara/sometimes","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudara%2Fsometimes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudara%2Fsometimes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudara%2Fsometimes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudara%2Fsometimes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sudara","download_url":"https://codeload.github.com/sudara/sometimes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230400606,"owners_count":18219830,"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":["random","ruby"],"created_at":"2024-12-07T13:16:58.243Z","updated_at":"2024-12-19T08:07:32.424Z","avatar_url":"https://github.com/sudara.png","language":"Ruby","readme":"# Sometimes\n\n[![Build Status](https://github.com/sudara/sometimes/workflows/rubyCI/badge.svg\n)](https://github.com/sudara/sometimes/actions)\n\nStop being so black and white. Mix things up a bit and execute code *sometimes*.\n\nA (very) simple collection of lil' helpers polluting Object namespaces since 2013 because...why the hell not?\n\n## Installation\n\nAdd this line to your Gemfile:\n\n```ruby\ngem 'sometimes'\n```\n\nAnd then execute:\n\n```console\n$ bundle\n```\n\nRequire when needed\n\n```ruby\nrequire 'sometimes'\n```\n\n## Usage\n\nSay something every other time\n\n```ruby\n# executes warm fuzzies 50% of the time\nsometimes do\n  puts \"Hey, you are awesome. You really are.\"\nend\n```\n\n\nMaybe you want to do something several times, but not always the exact same number of times\n\n```ruby\n# between 4 and 10 boogers made, it's unpredictable!\n(4..10).times do\n  pick_nose\nend\n```\n\n\nMaybe you want to remind someone of something, but not toooo often (It gets annoying!)\n\n```ruby\n# be annoying, but only 15% of the time\n15.percent_of_the_time do\n  puts \"Howdy, Don't forget to register!\"\nend\n\n33.percent_of_the_time do\n  be_very_polite\nend\n```\n\nShare a rare moment with your user\n\n```ruby\n# be really annoying about 5% of the time\nrarely do\n  puts \"How would you like some spammy spam spam!\"\nend\n\n1.percent_of_the_time do\n  puts \"Want to see something really cool?\"\nend\n```\n\nIf you can't say something nice, don't say anything at all:\n\n```ruby\nnever do\n  puts \"You're a terrible person\"\nend\n```\n\nAlways remember your manners:\n\n```ruby\nalways do\n  puts \"Thanks for sharing!\"\nend\n```\n\n### Otherwise\n\nCounting precisely is overrated.\n\n```ruby\n# Sometimes increment, sometimes don't\ni += sometimes(1)\n\n# 5% of the time add 10, otherwise increment\ni += rarely(10, otherwise:1)\n```\n\nModel real life state, like your calendar\n```ruby\n# 95% of the time you are in meetings\nstatus = mostly ? \"busy\" : \"free\"\n\n# same as above\nstatus = mostly(\"busy\", otherwise: \"free\")\n\n```\n\n## Why?\n\nThis gem was made so [alonetone](http://github.com/sudara/alonetone) could bit more fun when displaying notices and communicating to our users.\n\nWe are human, and have personality. Shouldn't our applications reflect this? Be predictable where it counts. But toss in some spice here and there — it is always a good thing.\n\n\n## Versions\n\nWorks with ruby 2.7 and higher.\n\nUse version 1.0.0 to support ruby \u003c 2.7\nUse version 0.0.2 to support ruby \u003c 2.2\n\n## Updating and Releasing this gem\n\n* Update lib/sometimes/version.rb\n\n```\nbundle \u0026\u0026 bundle exec rake gemspec\nbundle exec rake release\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsudara%2Fsometimes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsudara%2Fsometimes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsudara%2Fsometimes/lists"}