<commit_before>var io = io.connect(),
    twats = [];

var template = '<div class="tweet">'+
'<p class="twtext">'+
'<%= text %>'+
'</p><p class="twdate">'+
'<%= date %>'+
'</p></div>';

var maker = _.template(template);

$('#submit').click(function () {
  var hand = $('#handle').val();
  if (!hand) {
    alert('Please enter a twitter handle.');
  }
  io.emit('handle', { handle: hand });
});

io.on('twoots', function (twoots) {
  $('#twoots').html(' ');
  twats = jumble(twoots);
  console.log(twats);
  twats = _.map(twats, function (tweet) {
    return { text: tweet, date: new Date() };
  });
  for (var tw in twats) {
    $('#twoots').append(maker(twats[tw]));
  }
});

$("#handle").keyup(function(event){
    if(event.keyCode == 13){
      $("#submit").click();
    }
});

function jumble (tweets) {
  var words = [],
    newTweets = [];
  _.map(tweets, function (tweet) {
    words = _.union(words, (tweet.text).split(' '));
  });
  nextWord = 7;
  for (var i = 0; i <= 20; i++) {
    var newTweet = '';
    var tweetLen = Math.floor(Math.random()*140);
    while (newTweet.length < tweetLen) {
      var index = Math.floor(Math.random()*words.length);
      newTweet += words[index] + ' ';
      while (words[index].length < 5) {
        index++;
        newTweet += words[index] + ' ';
      }
    }
    newTweets.push(newTweet);
  }
  return newTweets;
}<commit_msg>Replaced union statement with concat to keep duplicate words<commit_after>var io = io.connect(),
    twats = [];

var template = '<div class="tweet">'+
'<p class="twtext">'+
'<%= text %>'+
'</p><p class="twdate">'+
'<%= date %>'+
'</p></div>';

var maker = _.template(template);

$('#submit').click(function () {
  var hand = $('#handle').val();
  if (!hand) {
    alert('Please enter a twitter handle.');
    return null;
  } else if (hand[0] == '@') {
    hand = hand.substring(1);
  }
  io.emit('handle', { handle: hand });
});

io.on('twoots', function (twoots) {
  $('#twoots').html(' ');
  twats = jumble(twoots);
  twats = _.map(twats, function (tweet) {
    return { text: tweet, date: new Date() };
  });
  for (var tw in twats) {
    $('#twoots').append(maker(twats[tw]));
  }
});

$("#handle").keyup(function(event){
    if(event.keyCode == 13){
      $("#submit").click();
    }
});

function jumble (tweets) {
  var words = [],
    newTweets = [];
  _.map(tweets, function (tweet) {
    words = words.concat(tweet.text.split(' '));
  });
  nextWord = 7;
  for (var i = 0; i <= 20; i++) {
    var newTweet = '';
    var tweetLen = Math.floor(Math.random()*140);
    while (newTweet.length < tweetLen) {
      var index = Math.floor(Math.random()*words.length);
      if (words[index].substring(0,4) != 'http') {
        newTweet += words[index] + ' ';
      }
      while (words[index].length < 5) {
        index++;
        if (words[index].substring(0,4) != 'http') {
          newTweet += words[index] + ' ';
        }
      }
    }
    newTweets.push(newTweet);
  }
  return newTweets;
}
{'fraction_non_alphanumeric': 0.22945320362294533, 'fraction_numerical': 0.00872190540087219, 'mean_word_length': 3.0242914979757085, 'pattern_counts': {'":': 0, '<': 25, '<?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': '2530115', 'n_tokens_mistral': 1120, 'n_tokens_neox': 1095, 'n_words': 223}