{"id":19343521,"url":"https://github.com/hex0cter/groovy-mixin","last_synced_at":"2025-07-27T22:40:59.045Z","repository":{"id":57719981,"uuid":"56807554","full_name":"hex0cter/groovy-mixin","owner":"hex0cter","description":"Groovy mixin -- Make your groovy development more joyful.","archived":false,"fork":false,"pushed_at":"2016-05-21T23:05:03.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-01-06T12:47:19.804Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Groovy","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/hex0cter.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":"2016-04-21T21:45:34.000Z","updated_at":"2018-02-07T14:33:30.000Z","dependencies_parsed_at":"2022-09-26T21:41:12.867Z","dependency_job_id":null,"html_url":"https://github.com/hex0cter/groovy-mixin","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/hex0cter%2Fgroovy-mixin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex0cter%2Fgroovy-mixin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex0cter%2Fgroovy-mixin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex0cter%2Fgroovy-mixin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hex0cter","download_url":"https://codeload.github.com/hex0cter/groovy-mixin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240449891,"owners_count":19803125,"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-11-10T03:38:34.489Z","updated_at":"2025-02-24T09:17:40.029Z","avatar_url":"https://github.com/hex0cter.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mixin for Groovy language\n\n[![Build Status](https://travis-ci.org/hex0cter/groovy-mixin.svg?branch=master)](https://travis-ci.org/hex0cter/groovy-mixin)\n\n\nGroovy is awesome. This library contains shortcuts to make your groovy development even more joyful.\n\n## Collections\n\nMissing the sample function from Ruby? Here it is. By enabling this library you can\n\n\n```groovy\n    [1, 2, 3, 4, 5].sample()  // Return 1 element randomly from array\n    [1, 2, 3, 4, 5].sample    // Same as above: return 1 element randomly from array\n    [1, 2, 3, 4, 5].sample(2) // Return 2 elements randomly from the array\n    (1..5).sample()           // Return 1 element randomly from the range\n    (1..5).sample             // Same as above: return 1 element randomly from the range\n```\n\nboth gives you a random number from 1 to 5.\n\nYou can also verify if an element or array of elements are included in another array or range by using\n\n```groovy\n    5.isPartOf [1, 2, 3, 4, 5] // Return true\n    [1, 2].isPartOf [1, 2, 3]  // Return true\n    3.isPartOf (1..5)          // Return true\n```\n\n## Date\n\nYou can use the syntax below to get a dynamic date:\n\n```groovy\n    5.years.ago\n    1.months.ago\n    2.days.ago\n    4.hours.ago\n    2.minutes.ago\n    3.seconds.ago\n    \n    5.years.later\n    1.months.later\n    2.days.later\n    3.hours.later\n    2.minutes.later\n    3.seconds.later \n```\n\nEach returns a instance of Date relative to the execution time.\n\n\n## How to use it?\n\n### Maven\n\nAdd the following dependency to your pom.xml:\n\n```xml\n    \u003cdependency\u003e\n      \u003cgroupId\u003ecom.github.hex0cter\u003c/groupId\u003e\n      \u003cartifactId\u003egroovy-mixin\u003c/artifactId\u003e\n      \u003cversion\u003e1.0.0\u003c/version\u003e\n    \u003c/dependency\u003e\n```\n\n### Gradle\n\nAdd the following dependency to you build.gradle\n\n```groovy\n    compile 'com.github.hex0cter:groovy-mixin:1.0.0'\n```\n\nAny feedback is welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhex0cter%2Fgroovy-mixin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhex0cter%2Fgroovy-mixin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhex0cter%2Fgroovy-mixin/lists"}