Skip to content

Instantly share code, notes, and snippets.

@mindboard
Last active November 4, 2015 09:05

Revisions

  1. mindboard revised this gist Nov 4, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion create-weekly-schedule.groovy
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ sb.append("""<html>
    <table border=0 style="border-collapse: collapse;border:solid 1px;">""")


    def cellW = 200;
    def cellW = 200
    def cellStyle0 = "width:${cellW}px;border-left:solid 1px #333;background-color:#eee;"

    sb.append("""
  2. mindboard created this gist Nov 4, 2015.
    70 changes: 70 additions & 0 deletions create-weekly-schedule.groovy
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,70 @@
    def sb = new StringBuffer()

    sb.append("""<html>
    <body>
    <table border=0 style="border-collapse: collapse;border:solid 1px;">""")


    def cellW = 200;
    def cellStyle0 = "width:${cellW}px;border-left:solid 1px #333;background-color:#eee;"

    sb.append("""
    <tr>
    <th></th>
    <th style="${cellStyle0}">MON</th>
    <th style="${cellStyle0}">TUE</th>
    <th style="${cellStyle0}">WED</th>
    <th style="${cellStyle0}">THU</th>
    <th style="${cellStyle0}">FRI</th>
    <th style="${cellStyle0}">SAT</th>
    <th style="${cellStyle0}">SUN</th>
    </tr>""")

    def cellStyle1 = 'height:24px;border-left:solid 1px #333;background-color:#eee;'

    sb.append("""
    <tr>
    <td></td>
    <td style="${cellStyle1}"></td>
    <td style="${cellStyle1}"></td>
    <td style="${cellStyle1}"></td>
    <td style="${cellStyle1}"></td>
    <td style="${cellStyle1}"></td>
    <td style="${cellStyle1}"></td>
    <td style="${cellStyle1}"></td>
    </tr>""")

    def color = '#999'
    def cellStyle2 = "border-left:solid 1px $color;height:15px;"
    def cellStyle3 = "border-left:solid 1px $color;border-top:solid 1px $color;height:15px;"

    //(0..24).each {
    (5..24).each {
    sb.append("""
    <tr>
    <th style="margin:0;padding-right:5px;width:50px;text-align:right;" rowspan="2"><span style="font-size:9px;">$it:00</span></th>
    <td style="$cellStyle2"></td>
    <td style="$cellStyle2"></td>
    <td style="$cellStyle2"></td>
    <td style="$cellStyle2"></td>
    <td style="$cellStyle2"></td>
    <td style="$cellStyle2"></td>
    <td style="$cellStyle2"></td>
    </tr>
    <tr>
    <td style="$cellStyle3"></td>
    <td style="$cellStyle3"></td>
    <td style="$cellStyle3"></td>
    <td style="$cellStyle3"></td>
    <td style="$cellStyle3"></td>
    <td style="$cellStyle3"></td>
    <td style="$cellStyle3"></td>
    </tr>""")
    }

    sb.append('''
    </table>
    </body>
    </html>''')

    new File('weekly-schedule.html').text = sb.toString()