<commit_before>//author: <NAME>
//https://github.com/blairvanderhoof/gist-embed
$(function(){
  var gistMarkerId = 'gist-',
    _guidIdCounter = 0;

  //find all code elements containing "gist-" the id attribute.
  $('code[data-gist-id*="'+gistMarkerId+'"], code[id*="'+gistMarkerId+'"]').each(function(){
    var $elem = $(this),
      id,
      url,
      file,
      line,
      data = {};

    //make block level so loading text shows properly
    $elem.css('display', 'block');

    id = $elem.attr('data-gist-id') || $elem.attr('id') || '';
    file = $elem.attr('data-file');
    line = $elem.attr('data-line') || '';
    line = line.replace(/ /g, '');

    if(file){
      data.file = file;
    }

    //if the id doesn't begin with 'gist-', then ignore the code block
    if (!id || id.indexOf('gist-') !== 0) return false;

    //get the numeric id from the id attribute of the element holder
    id = id.substr(0, gistMarkerId.length) === gistMarkerId ? id.replace(gistMarkerId, '') : null;

    //make sure result is a numeric id
    if(isNaN(parseInt(id, 10))){
      $elem.html('Failed loading gist with incorrect id format: ' + id);
      return false;
    }

    url = 'https://gist.github.com/' + id + '.json';

    //loading
    $elem.html('Loading gist ' + url + (data.file ? ', file: ' + data.file : '') + '...');

    //request the json version of this gist
    $.ajax({
      url: url,
      data: data,
      dataType: 'jsonp',
      timeout: 10000,
      success: function(response){
        var linkTag,
          lineNumbers,
          $responseDiv;

        //the html payload is in the div property
        if(response && response.div){

          //add the stylesheet if it does not exist
          if(response.stylesheet && $('link[href="' + response.stylesheet + '"]').length === 0){
            linkTag = document.createElement("link"),
            head = document.getElementsByTagName("head")[0];

            linkTag.type = "text/css";
            linkTag.rel = "stylesheet";
            linkTag.href = response.stylesheet;
            head.insertBefore(linkTag, head.firstChild);
          }

          $responseDiv = $(response.div);
          $elem.html('').append($responseDiv);

          //if user provided a line param, get the line numbers baesed on the criteria
          if(line){
            lineNumbers = getLineNumbers(line),

            //find all .line divs (acutal code lines) and remove them if they don't exist in the line param
            $responseDiv.find('.line').each(function(index){
              if(($.inArray(index + 1, lineNumbers)) === -1){
                $(this).remove();
              }
            });

            //find all .line-number divs (numbers on the gutter) and remove them if they don't exist in the line param
            $responseDiv.find('.line-number').each(function(index){
              if(($.inArray(index + 1, lineNumbers)) === -1){
                $(this).remove();
              }
            });
          }

          //option to remove footer
          if($elem.attr('data-hide-footer') === "true"){
            $responseDiv.find('.gist-meta').remove();
          }
<commit_msg>remove id from gist ajax response for uniqueness in dom<commit_after>//author: <NAME>
//https://github.com/blairvanderhoof/gist-embed
$(function(){
  var gistMarkerId = 'gist-',
    _guidIdCounter = 0;

  //find all code elements containing "gist-" the id attribute.
  $('code[data-gist-id*="'+gistMarkerId+'"], code[id*="'+gistMarkerId+'"]').each(function(){
    var $elem = $(this),
      id,
      url,
      file,
      line,
      data = {};

    //make block level so loading text shows properly
    $elem.css('display', 'block');

    id = $elem.attr('data-gist-id') || $elem.attr('id') || '';
    file = $elem.attr('data-file');
    line = $elem.attr('data-line') || '';
    line = line.replace(/ /g, '');

    if(file){
      data.file = file;
    }

    //if the id doesn't begin with 'gist-', then ignore the code block
    if (!id || id.indexOf('gist-') !== 0) return false;

    //get the numeric id from the id attribute of the element holder
    id = id.substr(0, gistMarkerId.length) === gistMarkerId ? id.replace(gistMarkerId, '') : null;

    //make sure result is a numeric id
    if(isNaN(parseInt(id, 10))){
      $elem.html('Failed loading gist with incorrect id format: ' + id);
      return false;
    }

    url = 'https://gist.github.com/' + id + '.json';

    //loading
    $elem.html('Loading gist ' + url + (data.file ? ', file: ' + data.file : '') + '...');

    //request the json version of this gist
    $.ajax({
      url: url,
      data: data,
      dataType: 'jsonp',
      timeout: 10000,
      success: function(response){
        var linkTag,
          lineNumbers,
          $responseDiv;

        //the html payload is in the div property
        if(response && response.div){

          //add the stylesheet if it does not exist
          if(response.stylesheet && $('link[href="' + response.stylesheet + '"]').length === 0){
            linkTag = document.createElement("link"),
            head = document.getElementsByTagName("head")[0];

            linkTag.type = "text/css";
            linkTag.rel = "stylesheet";
            linkTag.href = response.stylesheet;
            head.insertBefore(linkTag, head.firstChild);
          }

          //refernce to div
          $responseDiv = $(response.div);
          //remove id for uniqueness constraints
          $responseDiv.removeAttr('id');

          $elem.html('').append($responseDiv);

          //if user provided a line param, get the line numbers baesed on the criteria
          if(line){
            lineNumbers = getLineNumbers(line),

            //find all .line divs (acutal code lines) and remove them if they don't exist in the line param
            $responseDiv.find('.line').each(function(index){
              if(($.inArray(index + 1, lineNumbers)) === -1){
                $(this).remove();
              }
            });

            //find all .line-number divs (numbers on the gutter) and remove them if they don't exist in the line param
            $responseDiv.find('.line-number').each(function(index){
              if(($.inArray(index + 1, lineNumbers)) === -1){
                $(this).remove();
              }
            });
          }

          //option to remove footer
          if($elem.attr('data-hide-footer') === "true"){
            $responseDiv.find('.gist-meta').remove();
          }

{'fraction_non_alphanumeric': 0.15854221128709825, 'fraction_numerical': 0.004920805781946794, 'mean_word_length': 2.078088026502603, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, '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': '6089543', 'n_tokens_mistral': 1980, 'n_tokens_neox': 1881, 'n_words': 518}