<commit_before>function init() {

  var serverBaseUrl = document.domain;
  socket = io.connect(serverBaseUrl);
  var sessionId = '';

  function updateParticipants(participants) {
   $('#participants').html('');
   for (var i = 0; i < participants.length; i++) {
      $('#participants').append('<span id="' + participants[i].id + '">' +
        participants[i].name + ' ' + (participants[i].id === sessionId ? '(You)' : '') + '<br /></span>');
    } 
  }

  socket.on('connect', function () {
    sessionId = socket.io.engine.id;
    socket.emit('newUser', {id: sessionId, name: $('#name').val()});
  });

  socket.on('newConnection', function (data) {    
    updateParticipants(data.participants);
    pointsDrawn = data.pointsDrawn
    redraw();
  });

  socket.on('redrawFrame', function (data) { 
      combinePointArrays(data)
      redraw();
  });

  socket.on('userDisconnected', function(data) {
    $('#' + data.id).remove();
  });

  socket.on('nameChanged', function (data) {
    $('#' + data.id).html(data.name + ' ' + (data.id === sessionId ? '(You)' : '') + '<br />');
  });

  socket.on('incomingMessage', function (data) {
    var message = data.message;
    var name = data.name;
    $('#messages').prepend('<b>' + name + '</b><br />' + message + '<hr />');
  });

  socket.on('error', function (reason) {
    console.log('Unable to connect to server', reason);
  });

  function sendMessage() {
    var outgoingMessage = $('#outgoingMessage').val();
    var name = $('#name').val();
    $.ajax({
      url:  '/message',
      type: 'POST',
      contentType: 'application/json',
      dataType: 'json',
      data: JSON.stringify({message: outgoingMessage, name: name})
    });
  }

  function outgoingMessageKeyDown(event) {
    if (event.which == 13) {
      event.preventDefault();
      if ($('#outgoingMessage').val().trim().length <= 0) {
        return;
      }
      sendMessage();
      $('#outgoingMessage').val('');
    }
  }

  function outgoingMessageKeyUp() {
    var outgoingMessageValue = $('#outgoingMessage').val();
    $('#send').attr('disabled', (outgoingMessageValue.trim()).length > 0 ? false : true);
  }

  function nameFocusOut() {
    var name = $('#name').val();
    socket.emit('nameChange', {id: sessionId, name: name});
  }

  $('#outgoingMessage').on('keydown', outgoingMessageKeyDown);
  $('#outgoingMessage').on('keyup', outgoingMessageKeyUp);
  $('#name').on('focusout', nameFocusOut);
  $('#send').on('click', sendMessage);

}

$(document).on('ready', init);


function combinePointArrays(data) {
  // var regularPointHolder = []
  // var undoPointHolder = []
  // _.each(pointsDrawn, function(point){ 
  //   if (point["stored?"] = false) {
  //     regularPointHolder.push(point)
  //   }
  // });
  //  _.each(undoPointStore, function(point){ 
  //   if (point["stored?"] = false) {
  //     undoPointHolder.push(point)
  //   }
  // });
  pointsDrawn = data.pointsDrawn
  undoPointStore = data.undoPointStore
  // _.each(regularPointHolder, function(point){ 
  //   pointsDrawn.push(point)
  // });
  //  _.each(undoPointHolder, function(point){ 
  //     undopointStore.push(point)
  // });
}<commit_msg>bug is with heroku deployment, not point array combination<commit_after>function init() {

  var serverBaseUrl = document.domain;
  socket = io.connect(serverBaseUrl);
  var sessionId = '';

  function updateParticipants(participants) {
   $('#participants').html('');
   for (var i = 0; i < participants.length; i++) {
      $('#participants').append('<span id="' + participants[i].id + '">' +
        participants[i].name + ' ' + (participants[i].id === sessionId ? '(You)' : '') + '<br /></span>');
    } 
  }

  socket.on('connect', function () {
    sessionId = socket.io.engine.id;
    socket.emit('newUser', {id: sessionId, name: $('#name').val()});
  });

  socket.on('newConnection', function (data) {    
    updateParticipants(data.participants);
    pointsDrawn = data.pointsDrawn
    redraw();
  });

  socket.on('redrawFrame', function (data) { 
      combinePointArrays(data)
      redraw();
  });

  socket.on('userDisconnected', function(data) {
    $('#' + data.id).remove();
  });

  socket.on('nameChanged', function (data) {
    $('#' + data.id).html(data.name + ' ' + (data.id === sessionId ? '(You)' : '') + '<br />');
  });

  socket.on('incomingMessage', function (data) {
    var message = data.message;
    var name = data.name;
    $('#messages').prepend('<b>' + name + '</b><br />' + message + '<hr />');
  });

  socket.on('error', function (reason) {
    console.log('Unable to connect to server', reason);
  });

  function sendMessage() {
    var outgoingMessage = $('#outgoingMessage').val();
    var name = $('#name').val();
    $.ajax({
      url:  '/message',
      type: 'POST',
      contentType: 'application/json',
      dataType: 'json',
      data: JSON.stringify({message: outgoingMessage, name: name})
    });
  }

  function outgoingMessageKeyDown(event) {
    if (event.which == 13) {
      event.preventDefault();
      if ($('#outgoingMessage').val().trim().length <= 0) {
        return;
      }
      sendMessage();
      $('#outgoingMessage').val('');
    }
  }

  function outgoingMessageKeyUp() {
    var outgoingMessageValue = $('#outgoingMessage').val();
    $('#send').attr('disabled', (outgoingMessageValue.trim()).length > 0 ? false : true);
  }

  function nameFocusOut() {
    var name = $('#name').val();
    socket.emit('nameChange', {id: sessionId, name: name});
  }

  $('#outgoingMessage').on('keydown', outgoingMessageKeyDown);
  $('#outgoingMessage').on('keyup', outgoingMessageKeyUp);
  $('#name').on('focusout', nameFocusOut);
  $('#send').on('click', sendMessage);

}

$(document).on('ready', init);


function combinePointArrays(data) {
  var regularPointHolder = []
  var undoPointHolder = []
  _.each(pointsDrawn, function(point){ 
    if (point["stored?"] = false) {
      regularPointHolder.push(point)
    }
  });
   _.each(undoPointStore, function(point){ 
    if (point["stored?"] = false) {
      undoPointHolder.push(point)
    }
  });
  pointsDrawn = data.pointsDrawn
  undoPointStore = data.undoPointStore
  _.each(regularPointHolder, function(point){ 
    pointsDrawn.push(point)
  });
   _.each(undoPointHolder, function(point){ 
      undopointStore.push(point)
  });
}
{'fraction_non_alphanumeric': 0.20557050166165533, 'fraction_numerical': 0.001582528881152081, 'mean_word_length': 3.3676572218382863, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 21, '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': '1157178', 'n_tokens_mistral': 2055, 'n_tokens_neox': 2003, 'n_words': 358}