<commit_before><!DOCTYPE html>
<title>Display skittles</title>
<script src='//cdnjs.cloudflare.com/ajax/libs/three.js/r61/three.min.js'></script>
<script src='helvetiker_bold.js'></script>
<script src='lib/uclass_TeapotGeometry.js'></script>
<body>
<script>
var camera, scene, renderer;
var geometry, material, cube;
var skittles = {
    height: 316,
    width: 600,
    groups: [
        {
            color: 0xcc0000,
            elements: [
                {
                    y: 316 * Math.random(),
                    x: 600 * Math.random()
                },
                {
                    y: 316 * Math.random(),
                    x: 600 * Math.random()
                }
            ]
        },
        {
            color: 0xffff00,
            elements: [
                {
                    y: 316 * Math.random(),
                    x: 600 * Math.random()
                },
                {
                    y: 316 * Math.random(),
                    x: 600 * Math.random()
                }
            ]
        },
        {
            color: 0x0000cc,
            elements: [
                {
                    y: 316 * Math.random(),
                    x: 600 * Math.random()
                },
                {
                    y: 316 * Math.random(),
                    x: 600 * Math.random()
                }
            ]
        },
        {
            color: 0x0c00cc,
            elements: [
                {
                    y: 316 * Math.random(),
                    x: 600 * Math.random()
                },
                {
                    y: 316 * Math.random(),
                    x: 600 * Math.random()
                }
            ]
        }
    ]
};

function loadImage(path) {
  var img = new Image();
  img.onload = function() {
      init(skittles);
  };
  img.src = path;
  return img;
}

function init(skittles) {
    renderer = new THREE.WebGLRenderer();
    renderer.setSize(window.innerWidth, window.innerHeight);
    document.body.appendChild(renderer.domElement);

    camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 1000);
    camera.position.z = skittles.height * 1;
    camera.position.x = skittles.width / 2;
    camera.position.y = skittles.height / 2;

    scene = new THREE.Scene();

    // Add background image
    var canvas = document.createElement('canvas');
    canvas.width = skittles.width;
    canvas.height = skittles.height;
    var ctx = canvas.getContext('2d');
    ctx.drawImage(backgroundImage, 0, 0);
    var texture = new THREE.Texture(canvas);
    texture.needsUpdate = true;

    // Create background box
    background = new THREE.PlaneGeometry(skittles.width, skittles.height);
    backgroundMaterial = new THREE.MeshBasicMaterial( { map: texture } );
    var boundingBox = new THREE.Mesh( background, backgroundMaterial );

    boundingBox.position.x = skittles.width / 2;
    boundingBox.position.y = skittles.height / 2;

    scene.add(boundingBox);

    // Create skittles
    shapes = [];
    counts = [];

    skittles.groups.forEach(function(group, index) {
        group.elements.forEach(function(element) {
            // Create sphere
            var geometry = {
                0: new THREE.CubeGeometry(20, 20, 20),
                1: new THREE.SphereGeometry(20, 20, 20),
                2: new THREE.OctahedronGeometry(20, 0),
                3: new THREE.TeapotGeometry(20)
            }[index % 4];

            material = new THREE.MeshLambertMaterial({ color: group.color });
            cube = new THREE.Mesh(geometry, material);

            // Position sphere
            cube.position.x = element.x;
            cube.position.y = element.y;
            //cube.position.z = cube.geometry.radius * 1;

            // Add sphere
            shapes.push(cube);
            scene.add(cube);

            // Create number
            /*var text3d = new THREE.TextGeometry( group.elements.length, {
                size: 20,
                height: 4,
                font: "helvetiker",
                weight: "bold",
                style: "normal",
                bevelEnabled: true,
                bevelThickness: 5,
                bevelSize: 1
            });

            var textMesh = new THREE.Mesh( text3d, material );

            // Position number
            textMesh.position.x = element.x;
            textMesh.position.y = element.y + cube.geometry.radius * 1.1;
            textMesh.position.z = cube.geometry.radius;

            // Add number
            cube.textMesh = textMesh;
            counts.push(textMesh);
            scene.add(textMesh);*/
        });
    });

    var light = new THREE.PointLight(0xffffff);
    light.position = new THREE.Vector3(0,100,400);
    scene.add(light);

    animate();
}

function animate() {
    requestAnimationFrame(animate);

    var t = Date.now();

    for (var i=0; i<shapes.length; i++) {
        var offset = Math.sin(i * 10) + t / 1000;
        shapes[i].rotation.y = offset * Math.pow(-1, i);
        shapes[i].rotation.x = offset * Math.pow(-1, i);
        shapes[i].rotation.z = offset * Math.pow(-1, i);
        //shapes[i].textMesh.rotation.y = offset;
    }
<commit_msg>introducing MAGIC NUMBER<commit_after><!DOCTYPE html>
<title>Display skittles</title>
<script src='//cdnjs.cloudflare.com/ajax/libs/three.js/r61/three.min.js'></script>
<script src='helvetiker_bold.js'></script>
<script src='lib/uclass_TeapotGeometry.js'></script>
<body>
<script>
var camera, scene, renderer;
var shapes;
var skittles = {
    height: 316,
    width: 600,
    groups: [
        {
            color: 0xcc0000,
            elements: [
                {
                    y: 316 * Math.random(),
                    x: 600 * Math.random()
                },
                {
                    y: 316 * Math.random(),
                    x: 600 * Math.random()
                }
            ]
        },
        {
            color: 0xffff00,
            elements: [
                {
                    y: 316 * Math.random(),
                    x: 600 * Math.random()
                },
                {
                    y: 316 * Math.random(),
                    x: 600 * Math.random()
                }
            ]
        },
        {
            color: 0x0000cc,
            elements: [
                {
                    y: 316 * Math.random(),
                    x: 600 * Math.random()
                },
                {
                    y: 316 * Math.random(),
                    x: 600 * Math.random()
                }
            ]
        },
        {
            color: 0x0c00cc,
            elements: [
                {
                    y: 316 * Math.random(),
                    x: 600 * Math.random()
                },
                {
                    y: 316 * Math.random(),
                    x: 600 * Math.random()
                }
            ]
        }
    ]
};

function loadImage(path) {
  var img = new Image();
  img.onload = function() {
      init(skittles);
  };
  img.src = path;
  return img;
}

function init(skittles) {
    renderer = new THREE.WebGLRenderer();
    renderer.setSize(window.innerWidth, window.innerHeight);
    document.body.appendChild(renderer.domElement);

    camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 1000);
    camera.position.z = skittles.height * 1;
    camera.position.x = skittles.width / 2;
    camera.position.y = skittles.height / 2;

    scene = new THREE.Scene();

    // Add background image
    var canvas = document.createElement('canvas');
    canvas.width = skittles.width;
    canvas.height = skittles.height;
    var ctx = canvas.getContext('2d');
    ctx.drawImage(backgroundImage, 0, 0);
    var texture = new THREE.Texture(canvas);
    texture.needsUpdate = true;

    // Create background box
    var background = new THREE.PlaneGeometry(skittles.width, skittles.height);
    var backgroundMaterial = new THREE.MeshBasicMaterial( { map: texture } );
    var boundingBox = new THREE.Mesh( background, backgroundMaterial );

    boundingBox.position.x = skittles.width / 2;
    boundingBox.position.y = skittles.height / 2;

    scene.add(boundingBox);

    // Create skittles
    shapes = [];

    skittles.groups.forEach(function(group, index) {
        group.elements.forEach(function(element) {
            var MAGIC_NUMBER = 20;
            // Create sphere
            var geometry = {
                0: new THREE.CubeGeometry(MAGIC_NUMBER, MAGIC_NUMBER, MAGIC_NUMBER),
                1: new THREE.SphereGeometry(MAGIC_NUMBER, MAGIC_NUMBER, MAGIC_NUMBER),
                2: new THREE.OctahedronGeometry(MAGIC_NUMBER, 0),
                3: new THREE.TeapotGeometry(MAGIC_NUMBER)
            }[index % 4];

            material = new THREE.MeshLambertMaterial({ color: group.color });
            cube = new THREE.Mesh(geometry, material);

            // Position sphere
            cube.position.x = element.x;
            cube.position.y = element.y;
            cube.position.z = MAGIC_NUMBER;

            // Add sphere
            shapes.push(cube);
            scene.add(cube);

            // Create number
            var text3d = new THREE.TextGeometry( group.elements.length, {
                size: MAGIC_NUMBER,
                height: 4,
                font: "helvetiker",
                weight: "bold",
                style: "normal",
                bevelEnabled: true,
                bevelThickness: 5,
                bevelSize: 1
            });

            var textMesh = new THREE.Mesh( text3d, material );

            // Position number
            textMesh.position.x = element.x;
            textMesh.position.y = element.y + MAGIC_NUMBER * 1.1;
            textMesh.position.z = MAGIC_NUMBER * 1.5;

            // Add number
            cube.textMesh = textMesh;
            scene.add(textMesh);
        });
    });

    var light = new THREE.PointLight(0xffffff);
    light.position = new THREE.Vector3(0,100,400);
    scene.add(light);

    animate();
}

function animate() {
    requestAnimationFrame(animate);

    var t = Date.now();

    for (var i=0; i<shapes.length; i++) {
        var offset = Math.sin(i * 10) + t / 1000;
        shapes[i].rotation.y = offset * Math.pow(-1, i);
        shapes[i].rotation.x = offset * Math.pow(-1, i);
        shapes[i].rotation.z = offset * Math.pow(-1, i);

        shapes[i].textMesh.rotation.y = offset;
    }

{'fraction_non_alphanumeric': 0.12164869764335465, 'fraction_numerical': 0.02509302547466845, 'mean_word_length': 1.4490654205607476, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 25, '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': '541369', 'n_tokens_mistral': 3344, 'n_tokens_neox': 2953, 'n_words': 625}