<commit_before>/**
 * Flot plugin for snapping the xaxis to predefined time ranges.
 *
 * @author <NAME>
 */
(function($){
    function init(plot) {
        var _stripTimezone = function(date) {
            var opts = plot.getOptions(), newDate;
            
            // use a given timezone offset if it exists
            if (opts.xaxis.tzOffset) {
                newDate = new Date(date.getTime() - opts.xaxis.tzOffset);
            } else {
                newDate = date.toUTCString();<commit_msg>Added comments to the snap plugin ready for a blog post.<commit_after>/**
 * Flot plugin for snapping the xaxis to predefined time ranges.
 *
 * @author <NAME>
 *
 * This plugin adds four public functions to the flot API
 *  > nextRange, prevRange, now and snapTo
 *
 *  Each of these function take two of the same parameters: range and xNum.
 *
 *  xNum = the xaxis number (0, 1, 2, ...)
 *    in most cases this will be 0 unless you have multiple xaxis'
 *
 *  range = the time range for snapping.
 *    possible values are: hour, day, week, month or year
 *
 *  eg.
 *        nextRange("week", 0)  - will move the xaxis time range to
 *                                one week in the future.
 *
 *        now("day", 0)         - will snap the time range to the start
 *                                of the current day (midnight).
 */
(function($){
    function init(plot) {
        var _stripTimezone = function(date) {
            var opts = plot.getOptions(), newDate;
            
            // use a given timezone offset if it exists
            if (opts.xaxis.tzOffset) {
                newDate = new Date(date.getTime() - opts.xaxis.tzOffset);
            } else {
                newDate = date.toUTCString();
{'fraction_non_alphanumeric': 0.09884393063583816, 'fraction_numerical': 0.003468208092485549, 'mean_word_length': 1.8658940397350994, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5422241', 'n_tokens_mistral': 492, 'n_tokens_neox': 477, 'n_words': 181}