<commit_before>/* global define, initWebgl, HeatmapShader, getTransformationMatrix */
/*jslint bitwise: true */
(function (window) {
  'use strict';

  var attachWaterfallShader = function (ctx, dimensions) {
    var wParams = {};
    initWebgl(wParams);
    new HeatmapShader().getFloatingShader(ctx, false);
    new HeatmapShader().getFloatingShader(ctx, true);
    var programC = ctx.myPrograms.floatingShaderC;
    var programBw = ctx.myPrograms.floatingShaderBw;
    var particleBuffer = ctx.createBuffer();
    var buffer = {};
    buffer.setColumn = function () {};

    var initBuffer = function (width, height) {
      var shift = 0;
      var pointer = 0;

      buffer.xOffset = 0;
      buffer.speed = 2 / width;
      buffer.columnPointer = 0;
      buffer.arraySize = 3 * width * height;
      buffer.vertices = new Float32Array(buffer.arraySize);
      for (var cnt = 0; cnt < width; cnt++) {
        var s = pointer;
        shift -= 2 / width;
        for (var i = 0; i < height; i++) {
          var data = new Float32Array(3);
          data[0] = 0;
          data[1] = 0;
          data[2] = 0;
          pointer = (s + i * 3) % (buffer.arraySize);
          buffer.vertices.set(data, pointer);
        }
        pointer = (s + height * 3) % (buffer.arraySize);
      }
      ctx.bindBuffer(ctx.ARRAY_BUFFER, particleBuffer);
      ctx.bufferData(ctx.ARRAY_BUFFER, buffer.vertices, ctx.DYNAMIC_DRAW);
      buffer.setColumn = function (d) {
        ctx.bindBuffer(ctx.ARRAY_BUFFER, particleBuffer);
        var arrayByteSize = buffer.arraySize * 12;
        var offset = buffer.columnPointer * height * 12;
        for (var i = 0; i < d.length && i < height; i++) {
          var data = new Float32Array(3);
          data[0] = buffer.xOffset + 1;
          data[1] = (i * 2 / d.length) - 1;
          data[2] = -d[i];
          ctx.bufferSubData(ctx.ARRAY_BUFFER, (offset + i * 12) % arrayByteSize, data);
        }

        buffer.columnPointer = (buffer.columnPointer + 1) % width;
        buffer.xOffset += buffer.speed;
      };
    };

    if (dimensions) {
      initBuffer(dimensions.x, dimensions.y);
    } else {
      initBuffer(100, 100);<commit_msg>array size can be any value<commit_after>/* global define, initWebgl, HeatmapShader, getTransformationMatrix */
/*jslint bitwise: true */
(function (window) {
  'use strict';

  var attachWaterfallShader = function (ctx, dimensions) {
    var wParams = {};
    initWebgl(wParams);
    new HeatmapShader().getFloatingShader(ctx, false);
    new HeatmapShader().getFloatingShader(ctx, true);
    var programC = ctx.myPrograms.floatingShaderC;
    var programBw = ctx.myPrograms.floatingShaderBw;
    var particleBuffer = ctx.createBuffer();
    var buffer = {};
    buffer.setColumn = function () {};

    var initBuffer = function (width, height) {
      var shift = 0;
      var pointer = 0;

      buffer.xOffset = 0;
      buffer.speed = 2 / width;
      buffer.columnPointer = 0;
      buffer.arraySize = 3 * width * height;
      buffer.vertices = new Float32Array(buffer.arraySize);
      for (var cnt = 0; cnt < width; cnt++) {
        var s = pointer;
        shift -= 2 / width;
        for (var i = 0; i < height; i++) {
          var data = new Float32Array(3);
          data[0] = 0;
          data[1] = 0;
          data[2] = 0;
          pointer = (s + i * 3) % (buffer.arraySize);
          buffer.vertices.set(data, pointer);
        }
        pointer = (s + height * 3) % (buffer.arraySize);
      }
      ctx.bindBuffer(ctx.ARRAY_BUFFER, particleBuffer);
      ctx.bufferData(ctx.ARRAY_BUFFER, buffer.vertices, ctx.DYNAMIC_DRAW);
      buffer.setColumn = function (d) {
        ctx.bindBuffer(ctx.ARRAY_BUFFER, particleBuffer);
        var arrayByteSize = buffer.arraySize * 12;
        var offset = buffer.columnPointer * height * 12;
        var i = 0;
        if (d.length < height) {
          d.length = height;
          for (i = d.length; i < height; i++) {
            d[i] = 0;
          }
        }
        for (i = 0; i < height; i++) {
          var data = new Float32Array(3);
          data[0] = buffer.xOffset + 1;
          data[1] = (i * 2 / d.length) - 1;
          data[2] = -d[i];
          ctx.bufferSubData(ctx.ARRAY_BUFFER, (offset + i * 12) % arrayByteSize, data);
        }

        buffer.columnPointer = (buffer.columnPointer + 1) % width;
        buffer.xOffset += buffer.speed;
      };
    };

    if (dimensions) {
      initBuffer(dimensions.x, dimensions.y);
    } else {
      initBuffer(100, 100);
{'fraction_non_alphanumeric': 0.1328625027587729, 'fraction_numerical': 0.02030456852791878, 'mean_word_length': 2.2164655784244145, 'pattern_counts': {'":': 0, '<': 12, '<?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': '6932560', 'n_tokens_mistral': 1505, 'n_tokens_neox': 1426, 'n_words': 353}