<commit_before><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>

<h2>Using polly-js with jQuery</h2>
<button id="btnWillPass">Load users from valid exiting site</button>
<button id="btnWillFail">Load users from non exiting site</button>

<ul id="result"></ul>

<script src="//code.jquery.com/jquery.js"></script>
<script src="../../src/polly.js"></script>

<script>
    $(function () {

        function log(text) {
            $('<li>')
                    .text(text)
                    .appendTo('#result');

        }

        function loadUsers(url){
            polly
                .retry(5)
                .executeForPromise(function () {
                    log('About to try and load users.');
                    return $.getJSON(url);
                })
                .then(function (result) {
                    log('Success: Loaded ' + result.length + ' users.');
                }, function (err) {
                    log('Error: Failed to load users.');
                });
        }

        $('#btnWillPass').click(function () {
            loadUsers('http://jsonplaceholder.typicode.com/users');
        });

        $('#btnWillFail').click(function () {
            loadUsers('http://www.this-is-no-site.com/users');
        });
    });
</script>
</body>
</html><commit_msg>Fix syntax<commit_after><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>

<h2>Using polly-js with jQuery</h2>
<button id="btnWillPass">Load users from valid exiting site</button>
<button id="btnWillFail">Load users from non exiting site</button>

<ul id="result"></ul>

<script src="//code.jquery.com/jquery.js"></script>
<script src="../../src/polly.js"></script>

<script>
    $(function () {

        function log(text) {
            $('<li>')
                    .text(text)
                    .appendTo('#result');

        }

        function loadUsers(url){
            polly()
                .retry(5)
                .executeForPromise(function () {
                    log('About to try and load users.');
                    return $.getJSON(url);
                })
                .then(function (result) {
                    log('Success: Loaded ' + result.length + ' users.');
                }, function (err) {
                    log('Error: Failed to load users.');
                });
        }

        $('#btnWillPass').click(function () {
            loadUsers('http://jsonplaceholder.typicode.com/users');
        });

        $('#btnWillFail').click(function () {
            loadUsers('http://www.this-is-no-site.com/users');
        });
    });
</script>
</body>
</html>
{'fraction_non_alphanumeric': 0.17087931648273408, 'fraction_numerical': 0.002847988608045568, 'mean_word_length': 1.5406871609403254, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4094007', 'n_tokens_mistral': 827, 'n_tokens_neox': 783, 'n_words': 148}