<commit_before>$(function(){
  var Guid = Backbone.Model.extend({
    defaults: function() {
      return {
        guid: "00000000-0000-4000-0000-000000000000"
      };
    },
    getDisplay: function(options) {
      var displayValue = this.get('guid');

      if (options.bUppercase) displayValue = displayValue.toUpperCase();
      if (!options.bDashes) displayValue = displayValue.replace(/-/g,'');
      if (options.bBraces) displayValue = '{' + displayValue + '}';
      if (options.bCommas) displayValue = displayValue + ',';

      return displayValue;
    }
  });

  var GuidList = Backbone.Collection.extend({
    model: Guid,
    seperator: "\n",
    copy: function(options) {
        var result = [];
        this.models.map(function(guid) {
          return result.push(guid.getDisplay(options));
        });
        return result.join(this.seperator);
    }
  });
  
  var Guids = new GuidList;
  
  var GuidView = Backbone.View.extend({
    tagName: 'li',
    render: function(options) {
      this.$el.html(this.model.getDisplay(options));
      return this;
    }
  });

  var AppView = Backbone.View.extend({
    el: $('#guid-app'),

    nQuantity: $('#nQuantity'),
    bUppercase: $('#bUppercase'),
    bDashes: $('#bDashes'),
    bBraces: $('#bBraces'),
    bCommas: $('#bCommas'),
    aCopy: $('#aCopy'),
    
    options: {
      bUppercase: false,
      bDashes: true,
      bBraces: false,
      bCommas: false
    },

    events: {
      'click #aGenerate': 'generate',
      'click #bUppercase': 'render',
      'click #bDashes': 'render',
      'click #bBraces': 'render',
      'click #bCommas': 'render'
    },

    initialize: function() {
      this.listenTo(Guids, 'reset', this.render);
      this.setOptions();

      ZeroClipboard.config({moviePath: 'js/ZeroClipboard.swf'});
      this.clipper = new ZeroClipboard(aCopy);
      this.clipper.on('load', function(clipper) {
        clipper.on('complete', function(clipper) {
          $('#aCopy').prop('disabled', true).html('<span class="glyphicon glyphicon-ok"></span> Copied')
        });
      });

      this.generate();
    },

    generate: function() {
      var numberOfGuids = parseInt($('#nQuantity').val());
      Guids.reset(guid(numberOfGuids));
    },

    render: function() {
      this.setOptions();

      var guidList = this.$('#guid-list');
      guidList.empty();
      Guids.each(function(guid) {
        var view = new GuidView({model: guid});
        guidList.append(view.render(this.options).el);
      }, this);

      this.clipper.setText(Guids.copy(this.options));
      this.aCopy.removeProp('disabled').html('<span class="glyphicon glyphicon-export"></span> Copy</button>');
    },

    setOptions: function() {
      this.options = {
        bUppercase: this.bUppercase.prop('checked'),
        bDashes: this.bDashes.prop('checked'),
        bBraces: this.bBraces.prop('checked'),
        bCommas: this.bCommas.prop('checked')
      };
    }
  });

  var App = new AppView;
});<commit_msg>Standardize to four-space code alignment<commit_after>$(function(){
    var Guid = Backbone.Model.extend({
        defaults: function() {
            return {
                guid: "00000000-0000-4000-0000-000000000000"
            };
        },
        getDisplay: function(options) {
            var displayValue = this.get('guid');

            if (options.bUppercase) displayValue = displayValue.toUpperCase();
            if (!options.bDashes) displayValue = displayValue.replace(/-/g,'');
            if (options.bBraces) displayValue = '{' + displayValue + '}';
            if (options.bCommas) displayValue = displayValue + ',';

            return displayValue;
        }
    });

    var GuidList = Backbone.Collection.extend({
        model: Guid,
        seperator: "\n",
        copy: function(options) {
                var result = [];
                this.models.map(function(guid) {
                    return result.push(guid.getDisplay(options));
                });
                return result.join(this.seperator);
        }
    });
    
    var Guids = new GuidList;
    
    var GuidView = Backbone.View.extend({
        tagName: 'li',
        render: function(options) {
            this.$el.html(this.model.getDisplay(options));
            return this;
        }
    });

    var AppView = Backbone.View.extend({
        el: $('#guid-app'),

        nQuantity: $('#nQuantity'),
        bUppercase: $('#bUppercase'),
        bDashes: $('#bDashes'),
        bBraces: $('#bBraces'),
        bCommas: $('#bCommas'),
        aCopy: $('#aCopy'),
        
        options: {
            bUppercase: false,
            bDashes: true,
            bBraces: false,
            bCommas: false
        },

        events: {
            'click #aGenerate': 'generate',
            'click #bUppercase': 'render',
            'click #bDashes': 'render',
            'click #bBraces': 'render',
            'click #bCommas': 'render'
        },

        initialize: function() {
            this.listenTo(Guids, 'reset', this.render);
            this.setOptions();

            ZeroClipboard.config({moviePath: 'js/ZeroClipboard.swf'});
            this.clipper = new ZeroClipboard(aCopy);
            this.clipper.on('load', function(clipper) {
                clipper.on('complete', function(clipper) {
                    $('#aCopy').prop('disabled', true).html('<span class="glyphicon glyphicon-ok"></span> Copied')
                });
            });

            this.generate();
        },

        generate: function() {
            var numberOfGuids = parseInt($('#nQuantity').val());
            Guids.reset(guid(numberOfGuids));
        },

        render: function() {
            this.setOptions();

            var guidList = this.$('#guid-list');
            guidList.empty();
            Guids.each(function(guid) {
                var view = new GuidView({model: guid});
                guidList.append(view.render(this.options).el);
            }, this);

            this.clipper.setText(Guids.copy(this.options));
            this.aCopy.removeProp('disabled').html('<span class="glyphicon glyphicon-export"></span> Copy</button>');
        },

        setOptions: function() {
            this.options = {
                bUppercase: this.bUppercase.prop('checked'),
                bDashes: this.bDashes.prop('checked'),
                bBraces: this.bBraces.prop('checked'),
                bCommas: this.bCommas.prop('checked')
            };
        }
    });

    var App = new AppView;
});
{'fraction_non_alphanumeric': 0.15934486453390478, 'fraction_numerical': 0.009796418184601256, 'mean_word_length': 2.0618556701030926, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, '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': '38445', 'n_tokens_mistral': 2023, 'n_tokens_neox': 1915, 'n_words': 336}