<commit_before>$(function() {
    // Init Ace editor
    var editor = ace.edit("editor");
    editor.setTheme("ace/theme/monokai");
    editor.getSession().setMode("ace/mode/golang");

    // Marddown
    marked.setOptions({
      renderer: new marked.Renderer(),
      gfm: true,
      tables: true,
      breaks: false,
      pedantic: false,
      sanitize: false,
      smartLists: true,
      smartypants: false
    });

    // Render description markdown
    var $description = $("#description");
    if (window.description) {
        $description.html(marked(window.description));
    }

    var $stdoutWrapper = $("#stdout_wrapper");
    var $stderrWrapper = $("#stderr_wrapper");
    var $compileErrorWrapper = $("#compile_error_wrapper");

    var $stdout = $("#stdout");
    var $stderr = $("#stderr");
    var $compileError = $("#compile_error");

    var showStdout = function(content) {
        $stdoutWrapper.fadeIn(400);
        $stdout.html(content);
    };

    var showStderr = function(content) {
        $stderrWrapper.fadeIn(400);
        $stderr.html(content);
    };

    var showCompileError = function(content) {
        $compileErrorWrapper.fadeIn(400);
        $compileError.html(content);
    };

    var cleanResults = function() {
        $stdout.html("");
        $stderr.html("");
        $compileError.html("");
    };

    var hideResults = function() {
        $stdoutWrapper.hide();
        $stderrWrapper.hide();
        $compileErrorWrapper.hide();
    };

    var equalsIgnoreLineEnding = function(s1, s2) {
        return s1.replace(/\r\n/g, '\n') == s2.replace(/\r\n/g, '\n');
    }

    var compileDone = function(data) {
        // Clean and hide all results
        hideResults();
        cleanResults();

        // Show stdout, stderr, compile error
        var response = JSON.parse(data);
        var errMsg = response["Errors"];
        var stdout = "";
        if (errMsg) {
            showCompileError(errMsg);
        } else {
            for (var i in response["Events"]) {
                var event = response["Events"][i];
                if (event["Kind"] == "stdout" && event["Delay"] == 0) {
                    stdout = event["Message"];
                    showStdout(stdout);
                }
                if (event["Kind"] == "stderr" && event["Delay"] == 0) {
                    showStderr(event["Message"]);
                }
            }

            // Check if stdout is as expected
            if (window.expectedStdout) {
                if (equalsIgnoreLineEnding(window.expectedStdout, stdout)) {
                    swal("Good job!", "You passed the test", "success")
                } else {
                    $.growl.warning({ message: "Not correct. :)" });
                }
            }
        }
    };<commit_msg>check result after stdout annimation<commit_after>$(function() {
    // Init Ace editor
    var editor = ace.edit("editor");
    editor.setTheme("ace/theme/monokai");
    editor.getSession().setMode("ace/mode/golang");

    // Marddown
    marked.setOptions({
      renderer: new marked.Renderer(),
      gfm: true,
      tables: true,
      breaks: false,
      pedantic: false,
      sanitize: false,
      smartLists: true,
      smartypants: false
    });

    // Render description markdown
    var $description = $("#description");
    if (window.description) {
        $description.html(marked(window.description));
    }

    var $stdoutWrapper = $("#stdout_wrapper");
    var $stderrWrapper = $("#stderr_wrapper");
    var $compileErrorWrapper = $("#compile_error_wrapper");

    var $stdout = $("#stdout");
    var $stderr = $("#stderr");
    var $compileError = $("#compile_error");

    var showStdout = function(content, finishHook) {
        $stdoutWrapper.fadeIn(400, finishHook);
        $stdout.html(content);
    };

    var showStderr = function(content) {
        $stderrWrapper.fadeIn(400);
        $stderr.html(content);
    };

    var showCompileError = function(content) {
        $compileErrorWrapper.fadeIn(400);
        $compileError.html(content);
    };

    var cleanResults = function() {
        $stdout.html("");
        $stderr.html("");
        $compileError.html("");
    };

    var hideResults = function() {
        $stdoutWrapper.hide();
        $stderrWrapper.hide();
        $compileErrorWrapper.hide();
    };

    var equalsIgnoreLineEnding = function(s1, s2) {
        return s1.replace(/\r\n/g, '\n') == s2.replace(/\r\n/g, '\n');
    }

    var compileDone = function(data) {
        // Clean and hide all results
        hideResults();
        cleanResults();

        // Show stdout, stderr, compile error
        var response = JSON.parse(data);
        var errMsg = response["Errors"];
        var stdout = "";
        if (errMsg) {
            showCompileError(errMsg);
        } else {
            for (var i in response["Events"]) {
                var event = response["Events"][i];
                if (event["Kind"] == "stdout" && event["Delay"] == 0) {
                    stdout = event["Message"];
                    showStdout(stdout, function(){
                        // Check if stdout is as expected
                        if (window.expectedStdout) {
                            if (equalsIgnoreLineEnding(window.expectedStdout, stdout)) {
                                swal("Good job!", "You passed the test", "success")
                            } else {
                                $.growl.warning({ message: "Not correct. :)" });
                            }
                        }
                    });
                }
                if (event["Kind"] == "stderr" && event["Delay"] == 0) {
                    showStderr(event["Message"]);
                }
            }
        }
    };
{'fraction_non_alphanumeric': 0.14755232658709566, 'fraction_numerical': 0.005189413596263622, 'mean_word_length': 1.8177387914230019, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4180526', 'n_tokens_mistral': 1637, 'n_tokens_neox': 1558, 'n_words': 333}