<commit_before>var timespanSelection = function (d3) {
    var module = {};

    var startOfToday = function () {
        var today = new Date(),
            twoWeeksAgo = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 1);
        return +twoWeeksAgo;
    };

    var from7DaysAgo = function () {
        var today = new Date(),
            twoWeeksAgo = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 7);
        return +twoWeeksAgo;
    };
    var from2WeeksAgo = function () {
        var today = new Date(),
            twoWeeksAgo = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 14);
        return +twoWeeksAgo;
    };

    module.timespans = {
        all: {
            label: 'all time',
            timestamp: function () { return 0; }
        },
        twoWeeks: {
            label: 'last two weeks',
            timestamp: from2WeeksAgo
        },
        sevenDays: {
            label: 'last 7 days',
            timestamp: from7DaysAgo
        },
        today: {
            label: 'today',
            timestamp: startOfToday
        }
    };

    module.startingFromTimestamp = function (span) {
        return span.timestamp.call();
    };

    module.create = function (selectedSpan) {
        var onTimespanSelected;

        var container = d3.select(document.createElement('div'))
                .attr('class', 'timespan');

        var currentlySelected = container.append('span')
            .text(selectedSpan.label);

        var timespanList = container.append('div')
                .attr('class', 'timespanSelection')
                .text('Aggregate over data from')
                .append('ol')
                .attr('class', 'timespanList');

        Object.keys(module.timespans).forEach(function (spanName) {
            var span = module.timespans[spanName];

            timespanList.append('li')
                .attr('class', 'item')
                .append("button")
                .text(span.label)
                .on('click', function () {
                    currentlySelected.text(span.label);
                    onTimespanSelected(span);
                    d3.event.preventDefault();
                });
        });

        return {
            widget: container.node(),
            load: function (onTimespanSelectedFunction) {
                onTimespanSelected = onTimespanSelectedFunction;

                onTimespanSelected(selectedSpan);
            }
        };
    };

    return module;
}(d3);
<commit_msg>2 days ago as timespan<commit_after>var timespanSelection = function (d3) {
    var module = {};

    var fromDaysAgo = function (days) {
        return function () {
            var today = new Date(),
                twoWeeksAgo = new Date(today.getFullYear(), today.getMonth(), today.getDate() - days);
            return +twoWeeksAgo;
        };
    };

    module.timespans = {
        all: {
            label: 'all time',
            timestamp: function () { return 0; }
        },
        twoWeeks: {
            label: 'last two weeks',
            timestamp: fromDaysAgo(14)
        },
        sevenDays: {
            label: 'last 7 days',
            timestamp: fromDaysAgo(7)
        },
        twoDays: {
            label: 'last 2 days',
            timestamp: fromDaysAgo(2)
        },
        today: {
            label: 'today',
            timestamp: fromDaysAgo(1)
        }
    };

    module.startingFromTimestamp = function (span) {
        return span.timestamp.call();
    };

    module.create = function (selectedSpan) {
        var onTimespanSelected;

        var container = d3.select(document.createElement('div'))
                .attr('class', 'timespan');

        var currentlySelected = container.append('span')
            .text(selectedSpan.label);

        var timespanList = container.append('div')
                .attr('class', 'timespanSelection')
                .text('Aggregate over data from')
                .append('ol')
                .attr('class', 'timespanList');

        Object.keys(module.timespans).forEach(function (spanName) {
            var span = module.timespans[spanName];

            timespanList.append('li')
                .attr('class', 'item')
                .append("button")
                .text(span.label)
                .on('click', function () {
                    currentlySelected.text(span.label);
                    onTimespanSelected(span);
                    d3.event.preventDefault();
                });
        });

        return {
            widget: container.node(),
            load: function (onTimespanSelectedFunction) {
                onTimespanSelected = onTimespanSelectedFunction;

                onTimespanSelected(selectedSpan);
            }
        };
    };

    return module;
}(d3);

{'fraction_non_alphanumeric': 0.12059676750932449, 'fraction_numerical': 0.005594695399917115, 'mean_word_length': 1.5979547900968785, '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': '2130495', 'n_tokens_mistral': 1337, 'n_tokens_neox': 1254, 'n_words': 258}