<commit_before>(function() {

  //
  // - Global Variabls -
  //

  var isFirefox = navigator.userAgent.indexOf('Firefox') != -1;
  var isSafari  = (navigator.userAgent.indexOf('Safari') > 0 && navigator.userAgent.indexOf('Chrome') < 0) ? true : false;
  var msgBuffer = [];


  //
  // - Global Functions -
  //

  // NOTE: Modifies the passed object
  function prepSentData(data) {
    // Replace function placeholder's with actual functions
    (function freplace(rdata) {
      for(var prop in rdata) {
        if(typeof(rdata[prop]) == 'string' && rdata[prop].substr(0, 9) == 'function ') {
          // At some point in the future this could either call .toString() on the function or replace it with a version
          // of the function capable of making using a command to actually call the function over the websocket.
          try {
            eval('rdata[prop] = ' + rdata[prop]);
          } catch(err) {
            rdata[prop] = function() {};
          }
        } else if(_.isObject(rdata[prop])) {
          freplace(rdata[prop]);
        }
      }
    })(data);

    return JSON.retrocycle(data);
  }

  function logMsg(data) {
    if(isFirefox && !window.console.exception) {
      msgBuffer.push(data);
    } else {

      data.data = prepSentData(data.data);

      if(data.type && data.data) {
        var cdata = data.callerData,
            trace;
        if(cdata) {
          trace = ' -- Called from ' + cdata.file + ':' + cdata.line + ':' + cdata.column + (cdata.callerName ? '(function ' + cdata.callerName + ')' : '');
        }

        var toLog;
        if (data.type == 'log' && data.config && data.config.convertStyles && !isSafari) {
          toLog = _stylize(data.data, trace);
        } else {
          toLog = data.data;
          if (trace) toLog.push(trace);
        }

        console[data.type].apply(console, toLog);
      } else {
        console.log(data);
      }
    }
  }


  //
  // - Websocket connection -
  //

  var host = location.protocol + '//<%= nomoHost %>:' + <%= nomoPort %>;
  var connection = io.connect(host, {
    'reconnect': true,
    'connect timeout': 4000,
    'max reconnection attempts': Infinity,
    'reconnection limit': Infinity
  });

  connection.on('connect', function() {
    logMsg(' ');
    logMsg(' /--------------------\\');
    logMsg('  Welcome to NodeMokey');
    logMsg(' \\--------------------/');
  });

  connection.on('reconnecting', function(delay, attempts) {
    if(delay > 4000) connection.socket.reconnectionDelay = 4000;
  });

  connection.on('console', function(data) {
    logMsg(data);
  });

  connection.on('disconnect', function() {
    msgBuffer = [];
  });


  // Interval for Firefox to log any buffered messages to the console as soon as it is opened
  //
  // The method to detect if Firebug is open may change. Look for changes here:
  //   http://stackoverflow.com/questions/398111/javascript-that-detects-firebug
  if(isFirefox) {
    var logInterval = setInterval(function() {
      if(msgBuffer.length && window.console.exception) {
        for(var i = 0; i < msgBuffer.length; i++) {
          logMsg(msgBuffer[i]);
        }

        msgBuffer = [];
<commit_msg>Fixes typo in welcome message<commit_after>(function() {

  //
  // - Global Variabls -
  //

  var isFirefox = navigator.userAgent.indexOf('Firefox') != -1;
  var isSafari  = (navigator.userAgent.indexOf('Safari') > 0 && navigator.userAgent.indexOf('Chrome') < 0) ? true : false;
  var msgBuffer = [];


  //
  // - Global Functions -
  //

  // NOTE: Modifies the passed object
  function prepSentData(data) {
    // Replace function placeholder's with actual functions
    (function freplace(rdata) {
      for(var prop in rdata) {
        if(typeof(rdata[prop]) == 'string' && rdata[prop].substr(0, 9) == 'function ') {
          // At some point in the future this could either call .toString() on the function or replace it with a version
          // of the function capable of making using a command to actually call the function over the websocket.
          try {
            eval('rdata[prop] = ' + rdata[prop]);
          } catch(err) {
            rdata[prop] = function() {};
          }
        } else if(_.isObject(rdata[prop])) {
          freplace(rdata[prop]);
        }
      }
    })(data);

    return JSON.retrocycle(data);
  }

  function logMsg(data) {
    if(isFirefox && !window.console.exception) {
      msgBuffer.push(data);
    } else {

      data.data = prepSentData(data.data);

      if(data.type && data.data) {
        var cdata = data.callerData,
            trace;
        if(cdata) {
          trace = ' -- Called from ' + cdata.file + ':' + cdata.line + ':' + cdata.column + (cdata.callerName ? '(function ' + cdata.callerName + ')' : '');
        }

        var toLog;
        if (data.type == 'log' && data.config && data.config.convertStyles && !isSafari) {
          toLog = _stylize(data.data, trace);
        } else {
          toLog = data.data;
          if (trace) toLog.push(trace);
        }

        console[data.type].apply(console, toLog);
      } else {
        console.log(data);
      }
    }
  }


  //
  // - Websocket connection -
  //

  var host = location.protocol + '//<%= nomoHost %>:' + <%= nomoPort %>;
  var connection = io.connect(host, {
    'reconnect': true,
    'connect timeout': 4000,
    'max reconnection attempts': Infinity,
    'reconnection limit': Infinity
  });

  connection.on('connect', function() {
    logMsg(' ');
    logMsg(' /--------------------\\');
    logMsg('  Welcome to NodeMonkey');
    logMsg(' \\--------------------/');
  });

  connection.on('reconnecting', function(delay, attempts) {
    if(delay > 4000) connection.socket.reconnectionDelay = 4000;
  });

  connection.on('console', function(data) {
    logMsg(data);
  });

  connection.on('disconnect', function() {
    msgBuffer = [];
  });


  // Interval for Firefox to log any buffered messages to the console as soon as it is opened
  //
  // The method to detect if Firebug is open may change. Look for changes here:
  //   http://stackoverflow.com/questions/398111/javascript-that-detects-firebug
  if(isFirefox) {
    var logInterval = setInterval(function() {
      if(msgBuffer.length && window.console.exception) {
        for(var i = 0; i < msgBuffer.length; i++) {
          logMsg(msgBuffer[i]);
        }

        msgBuffer = [];

{'fraction_non_alphanumeric': 0.16251761390324096, 'fraction_numerical': 0.007515265382808831, 'mean_word_length': 2.2116641528406236, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '565444', 'n_tokens_mistral': 2061, 'n_tokens_neox': 1952, 'n_words': 458}