Skip to content

Instantly share code, notes, and snippets.

@EwanDawson
Last active July 14, 2017 09:01
Show Gist options
  • Save EwanDawson/f587144a0c6e60203a18d2c75f73e07a to your computer and use it in GitHub Desktop.
Save EwanDawson/f587144a0c6e60203a18d2c75f73e07a to your computer and use it in GitHub Desktop.
import java.time.LocalDateTime
import static java.time.temporal.ChronoField.*
def now = LocalDateTime.now()
def everySecond = { it() }
def everyMinute = { if (now.get(SECOND_OF_MINUTE) == 0) it() }
def everyHour = { if (now.get(SECOND_OF_MINUTE) == 0 && now.get(MINUTE_OF_HOUR) == 0) it() }
def alert = { title, message -> invoke('https://gist.githubusercontent.com/EwanDawson/a65e720ed8ce0c9bc26d816de71ee776/raw/af0fa90ea080c758fec4077cd927dd1bd3d3da92/alert-me.groovy', [title, message]) }
everyMinute { alert("The time is now", now.toString()) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment