Groovy web console

subscribe to the feed Subscribe
to this
site
happy_birthday (via #groovywebconsole)
tweet this snippet Tweet
this
script

happy_birthday

Published 4 months ago by Anonymous
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def msg = """
  11  11   1111   11111   11111   11  11    11111   11  11111   111111  11  11  11111    1111   11  11  
  11  11  11  11  11  11  11  11   1111     11  11      11  11    11    11  11  11  11  11  11   1111   
  111111  111111  11111   11111     11      11111   11  11111     11    111111  11  11  111111    11    
  11  11  11  11  11      11        11      11  11  11  11  11    11    11  11  11  11  11  11    11    
  11  11  11  11  11      11        11      11111   11  11  11    11    11  11  11111   11  11    11    
"""

boolean isBirthday() {
    def date = Calendar?.instance?.getTime()?.getDateString()
    date?.startsWith('12/15')
}

def i = 0
5.times {
    if (isBirthday()) {
        println(i%2==0? msg : msg.replace('1', '.'))
        i++
    }
}