<commit_before># Description:
#   Utility commands surrounding Hubot uptime.
#
# Commands:
#   hubot ping - Reply with pong
#   hubot echo <text> - Reply back with <text>
#   hubot time - Reply with current time
#   hubot die - End hubot process

module.exports = (robot) ->
  deadlineIntervalId = null
  deadline = new Date()
  deadline.setDate(15)
  deadline.setMonth(7)
  deadline.setFullYear(2014)
  deadline.setUTCHours(14)
  deadline.setMinutes(0)
  dayDurationMilli = 24 * 3600 * 1000
  hourDurationMilli = 3600 * 1000
  minuteDurationMilli = 60 * 1000

  printTimeBeforeDeadline = (msg) ->
    now = new Date()
    durationBeforeDeadline = deadline.getTime() - now.getTime()
    console.log(now)
    console.log(deadline)
    console.log(durationBeforeDeadline)
    if durationBeforeDeadline > 0
      nbOfDays = durationBeforeDeadline / dayDurationMilli
      nbOfHours = (durationBeforeDeadline % dayDurationMilli) / hourDurationMilli
      nbOfMinutes = (durationBeforeDeadline % hourDurationMilli) / minuteDurationMilli
      nbOfSeconds = (durationBeforeDeadline % minuteDurationMilli) / 1000
      console.log("Ok guys, " + nbOfDays + " days, " + nbOfHours + " hours, " + nbOfMinutes + " minutes and " + nbOfSeconds + "seconds left, good luck")
      msg.send("Ok guys, " + nbOfDays + " days, " + nbOfHours + " hours, " + nbOfMinutes + " minutes and " + nbOfSeconds + "seconds left, good luck")
    else
      msg.send "Thesis is over, YIIIIIHHAAAAA!!!"
      clearInterval(deadlineIntervalId)
      deadlineIntervalId = null

  robot.respond /start thesis countdown/, (msg) ->
    if deadlineIntervalId != null
      msg.send "It's already running"
      return

    msg.send "Ok, I do that"
    printTimeBeforeDeadline(msg)
    deadlineIntervalId = setInterval() ->
      printTimeBeforeDeadline(msg)
    , dayDurationMilli

  robot.respond /stop thesis countdown/, (msg) ->
    msg.send "Ok, I stop that"
    clearInterval(deadlineIntervalId)
    deadlineIntervalId = null
<commit_msg>final version of thesis.coffee<commit_after># Description:
#   Utility commands surrounding Hubot uptime.
#
# Commands:
#   hubot ping - Reply with pong
#   hubot echo <text> - Reply back with <text>
#   hubot time - Reply with current time
#   hubot die - End hubot process

module.exports = (robot) ->
  deadlineIntervalId = null
  deadline = new Date()
  deadline.setDate(18)
  deadline.setMonth(7)
  deadline.setFullYear(2014)
  deadline.setUTCHours(14)
  deadline.setMinutes(0)
  dayDurationMilli = 24 * 3600 * 1000
  hourDurationMilli = 3600 * 1000
  minuteDurationMilli = 60 * 1000

  printTimeBeforeDeadline = (msg) ->
    now = new Date()
    durationBeforeDeadline = deadline.getTime() - now.getTime()
    if durationBeforeDeadline > 0
      nbOfDays = durationBeforeDeadline / dayDurationMilli
      nbOfHours = (durationBeforeDeadline % dayDurationMilli) / hourDurationMilli
      nbOfMinutes = (durationBeforeDeadline % hourDurationMilli) / minuteDurationMilli
      nbOfSeconds = (durationBeforeDeadline % minuteDurationMilli) / 1000
      msg.send("Ok guys, " + (nbOfDays | 0) + " days, " + (nbOfHours | 0) + " hours, " + (nbOfMinutes | 0) + " minutes and " + (nbOfSeconds | 0) + " seconds left, good luck")
    else
      msg.send "Thesis is over, YIIIIIHHAAAAA!!!"
      clearInterval(deadlineIntervalId)
      deadlineIntervalId = null

  robot.respond /start thesis countdown/, (msg) ->
    if deadlineIntervalId != null
      msg.send "It's already running"
      return

    msg.send "Ok, I do that"
    printTimeBeforeDeadline(msg)
    deadlineIntervalId = setInterval() ->
      printTimeBeforeDeadline(msg)
    , dayDurationMilli

  robot.respond /stop thesis countdown/, (msg) ->
    msg.send "Ok, I stop that"
    clearInterval(deadlineIntervalId)
    deadlineIntervalId = null

{'fraction_non_alphanumeric': 0.09957961114030478, 'fraction_numerical': 0.021544929059379925, 'mean_word_length': 3.5, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2447323', 'n_tokens_mistral': 1280, 'n_tokens_neox': 1201, 'n_words': 300}