<commit_before>__ = window.i18n.others.__.bind(i18n.others)
__n = window.i18n.others.__n.bind(i18n.others)

INTERVAL = config.get('poi.doyouknow.interval', 600) # seconds, time for a new tip
STICKY_TIME = 10 # seconds, time that the tip can't be refreshed by a "default"
PREFIX = __ "doyouknow-prefix"

update = (list) ->
  return if !config.get('poi.doyouknow.enabled', true) && list
  # Post a random tip
  window.log PREFIX + list[Math.floor(Math.random() * list.length)],
    priority: 1
    stickyFor: STICKY_TIME*1000
  # Reinvoked after certain interval
  setTimeout update, INTERVAL*1000, list

firstUpdate = ->
  document.removeEventListener 'DOMContentLoaded', firstUpdate
  list = (text for text in __ 'doyouknow-contents' when text)
  if list<commit_msg>DYK no longer shows if empty. Default interval set to 1800s.<commit_after>__ = window.i18n.others.__.bind(i18n.others)
__n = window.i18n.others.__n.bind(i18n.others)

INTERVAL = config.get('poi.doyouknow.interval', 1800) # seconds, time for a new tip
STICKY_TIME = 10 # seconds, time that the tip can't be refreshed by a "default"
PREFIX = __ "doyouknow-prefix"

update = (list) ->
  return if !config.get('poi.doyouknow.enabled', true) && list
  # Post a random tip
  window.log PREFIX + list[Math.floor(Math.random() * list.length)],
    priority: 1
    stickyFor: STICKY_TIME*1000
  # Reinvoked after certain interval
  setTimeout update, INTERVAL*1000, list

firstUpdate = ->
  document.removeEventListener 'DOMContentLoaded', firstUpdate
  list = (text for text in __ 'doyouknow-contents' when text)
  if list.length != 0
{'fraction_non_alphanumeric': 0.11620603015075377, 'fraction_numerical': 0.031407035175879394, 'mean_word_length': 4.418367346938775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4713681', 'n_tokens_mistral': 581, 'n_tokens_neox': 535, 'n_words': 148}