<commit_before>jQuery(function() {
    var textarea = document.getElementById('code'),
        editor = textarea && CodeMirror.fromTextArea(textarea);

    function updateOutput(code) {
        jQuery('#output').text(code);
    }

    function execute(code) {
        jQuery('<script></script>').text(code).appendTo(document.body);
    }

    function compile(callback) {
        jQuery.ajax({
            url: '/compile',
            method: 'POST',
            contentType: 'text/plain; charset=UTF-8',
            dataType: 'text',
            data: editor.getValue(),
            success: callback
        });  
    }

    jQuery('#execute-button').click(function() {
        compile(function(code) {
            updateOutput(code);
            execute(code);
        });
    });

    jQuery('#compile-button').click(function() {
        compile(updateOutput);
    });

    jQuery('#share-button').click(function() {
        document.location.hash = '#' + (btoa && btoa(editor.getValue()));
    });

    if(editor) {
        try {
            editor.setValue(atob(document.location.hash.substr(1)));
        } catch(e) {}
        compile(updateOutput);
    }<commit_msg>Only use hash if not empty<commit_after>jQuery(function() {
    var textarea = document.getElementById('code'),
        editor = textarea && CodeMirror.fromTextArea(textarea),
        hash = document.location.hash.substr(1);

    function updateOutput(code) {
        jQuery('#output').text(code);
    }

    function execute(code) {
        jQuery('<script></script>').text(code).appendTo(document.body);
    }

    function compile(callback) {
        jQuery.ajax({
            url: '/compile',
            method: 'POST',
            contentType: 'text/plain; charset=UTF-8',
            dataType: 'text',
            data: editor.getValue(),
            success: callback
        });  
    }

    jQuery('#execute-button').click(function() {
        compile(function(code) {
            updateOutput(code);
            execute(code);
        });
    });

    jQuery('#compile-button').click(function() {
        compile(updateOutput);
    });

    jQuery('#share-button').click(function() {
        document.location.hash = '#' + (btoa && btoa(editor.getValue()));
    });

    if(editor) {
        if(hash) {
            try {
                editor.setValue(atob(hash));
            } catch(e) {}
        }
        compile(updateOutput);
    }
{'fraction_non_alphanumeric': 0.1601320676846884, 'fraction_numerical': 0.0016508460586050352, 'mean_word_length': 2.0839694656488548, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3991084', 'n_tokens_mistral': 679, 'n_tokens_neox': 658, 'n_words': 96}