<commit_before>$(document).ready(function(){
  var socket = io();
  var attachFastClick = Origami.fastclick;
  attachFastClick(document.body);

  var DEAD_COLOR = '#eeeeee';
  var TEST_DEAD_COLOR = 'rgb(238, 238, 238)';
  var USER_COLOR = "#000000".replace(/0/g,function(){return (~~(Math.random()*16)).toString(16);});

  window.songjack = window.songjack || {};

  var isMousedown = false;   // Tracks status of mouse button
  $(document).mousedown(function() {
    isMousedown = true;      // When mouse goes down, set isDown to true
  })
  .mouseup(function() {
    isMousedown = false;    // When mouse goes up, set isDown to false
  });

  var colorCell = function(cellData) {
    var jcell = $('#' + cellData.x + '-' + cellData.y);

    jcell.css('background-color', cellData.alive ? cellData.css : DEAD_COLOR);
  }

  //assumes 'this' is the DOM element
  var requestCell = function() {
    //only proceed if cell is dead
    //jquery only returns a stupid rgb string
    if($(this).css("background-color") == TEST_DEAD_COLOR) {
      var coords = $(this).attr('id').split('-');

      socket.emit('requestCell', {
          x: coords[0],
          y: coords[1],
          alive: true,
          css: USER_COLOR
        }<commit_msg>optimize client side code<commit_after>$(document).ready(function(){
  var socket = io();
  var attachFastClick = Origami.fastclick;
  attachFastClick(document.body);

  var DEAD_COLOR = '#eeeeee';
  var TEST_DEAD_COLOR = 'rgb(238, 238, 238)';
  var USER_COLOR = "#000000".replace(/0/g,function(){return (~~(Math.random()*16)).toString(16);});

  window.songjack = window.songjack || {};

  var isMousedown = false;   // Tracks status of mouse button
  $(document).mousedown(function() {
    isMousedown = true;      // When mouse goes down, set isDown to true
  })
  .mouseup(function() {
    isMousedown = false;    // When mouse goes up, set isDown to false
  });

  //vanilla JS for speed
  var colorCell = function(cellData) {
    var cell = document.getElementById(cellData.x + '-' + cellData.y);

    cell.style.backgroundColor = cellData.alive ? cellData.css : DEAD_COLOR;
  }

  //assumes 'this' is the DOM element
  //vanilla JS for speeeed
  var requestCell = function() {
    //only proceed if cell is dead
    //jquery only returns a stupid rgb string
    if(!this.style.backgroundColor || this.style.backgroundColor == TEST_DEAD_COLOR) {
      var coords = this.id.split('-');

      socket.emit('requestCell', {
          x: coords[0],
          y: coords[1],
          alive: true,
          css: USER_COLOR
        }
{'fraction_non_alphanumeric': 0.14801864801864803, 'fraction_numerical': 0.017094017094017096, 'mean_word_length': 3.0234375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3986341', 'n_tokens_mistral': 884, 'n_tokens_neox': 822, 'n_words': 210}