<commit_before>$(document).ready(function() {

  // Collection
  var Territories = Backbone.PageableCollection.extend({
    state: {pageSize: 15},
    mode: "client"
  });
  
  var columns = [{name: "id", label: "ID", cell: "integer", editable:false},
	  {name: "name", label: "Name", cell: "string", editable:false},
	  {name: "code", label: "Code", cell: "string", editable:false},
	  {name: "continent_code", label: "Continent", cell: "string", editable:false}];
  
  
  // ** Example 1 **
  (function(){
	  var territories = new Territories(_.map(_territories, _.clone));
	  
	  // Grid
	  var grid = new Backgrid.Grid({
			columns: columns,
			collection: territories,
			className: "backgrid table"
		  }),
		  $grid = grid.render().$el;
	  $("#result").append($grid);

	  // Paginator
	  var paginator = new Backgrid.Extension.Paginator({
			collection: territories
		  }),
		  $paginator = paginator.render().$el;
	  $("#result").append($paginator);

	  // Select filter
	  var filter = new Backgrid.Extension.SelectFilter({
		  className: "backgrid-filter form-control",
		  collection: territories,
		  field: "continent_code",
		  selectOptions: _.union([{label: "All", value: null}],
			_.map(_continents, function(o) {return {label: o.name, value: o.code};}))
		}),
		$filter = filter.render().$el;
	  $("#filter").replaceWith($filter);
  }).call(this);
  
  // ** Example 2 **
  (function(){
	  var territories = new Territories(_.map(_territories, _.clone));
	  
	  // Grid
	  var grid = new Backgrid.Grid({
			columns: columns,
			collection: territories,
			className: "backgrid table"
		  }),
		  $grid = grid.render().$el;
	  $("#result-2").append($grid);

	  // Paginator
	  var paginator = new Backgrid.Extension.Paginator({
			collection: territories
		  }),
		  $paginator = paginator.render().$el;
	  $("#result-2").append($paginator);
	  
	  // Select filter
	  var filter = new Backgrid.Extension.SelectFilter({
		    className: "backgrid-filter form-control",
			collection: territories,
			field: "continent_code",
			selectOptions: [{
			  label: "All", value: null
			}, {
			  label: "Americas", value: ["NA", "SA"]
			}, {
			  label: "Europe", value: ["EU"]
			}, {
			  label: "Asia", value: ["AS"]
			}, {
			  label: "Other", value: ["AF", "OC", "AN"]
			}],
			makeMatcher: function(value) {
			  return function(model) {
				return _.indexOf(value, model.get(this.field)) >= 0;
			  }
			}
		  }),
		  $filter = filter.render().$el;
	  $("#filter-2").replaceWith($filter);
  }).call(this);
  
});<commit_msg>Adjusted indentation.<commit_after>$(document).ready(function() {

  // Collection
  var Territories = Backbone.PageableCollection.extend({
    state: {pageSize: 15},
    mode: "client"
  });
  
  var columns = [{name: "id", label: "ID", cell: "integer", editable:false},
    {name: "name", label: "Name", cell: "string", editable:false},
    {name: "code", label: "Code", cell: "string", editable:false},
    {name: "continent_code", label: "Continent", cell: "string", editable:false}];
  
  
  // ** Example 1 **
  (function(){
    var territories = new Territories(_.map(_territories, _.clone));
    
    // Grid
    var grid = new Backgrid.Grid({
      columns: columns,
      collection: territories,
      className: "backgrid table"
      }),
      $grid = grid.render().$el;
    $("#result").append($grid);

    // Paginator
    var paginator = new Backgrid.Extension.Paginator({
      collection: territories
      }),
      $paginator = paginator.render().$el;
    $("#result").append($paginator);

    // Select filter
    var filter = new Backgrid.Extension.SelectFilter({
      className: "backgrid-filter form-control",
      collection: territories,
      field: "continent_code",
      selectOptions: _.union([{label: "All", value: null}],
      _.map(_continents, function(o) {return {label: o.name, value: o.code};}))
    }),
    $filter = filter.render().$el;
    $("#filter").replaceWith($filter);
  }).call(this);
  
  // ** Example 2 **
  (function(){
    var territories = new Territories(_.map(_territories, _.clone));
    
    // Grid
    var grid = new Backgrid.Grid({
      columns: columns,
      collection: territories,
      className: "backgrid table"
      }),
      $grid = grid.render().$el;
    $("#result-2").append($grid);

    // Paginator
    var paginator = new Backgrid.Extension.Paginator({
      collection: territories
      }),
      $paginator = paginator.render().$el;
    $("#result-2").append($paginator);
    
    // Select filter
    var filter = new Backgrid.Extension.SelectFilter({
        className: "backgrid-filter form-control",
      collection: territories,
      field: "continent_code",
      selectOptions: [{
        label: "All", value: null
      }, {
        label: "Americas", value: ["NA", "SA"]
      }, {
        label: "Europe", value: ["EU"]
      }, {
        label: "Asia", value: ["AS"]
      }, {
        label: "Other", value: ["AF", "OC", "AN"]
      }],
      makeMatcher: function(value) {
        return function(model) {
        return _.indexOf(value, model.get(this.field)) >= 0;
        }
      }
      }),
      $filter = filter.render().$el;
    $("#filter-2").replaceWith($filter);
  }).call(this);
  
});
{'fraction_non_alphanumeric': 0.18409004196871423, 'fraction_numerical': 0.003052270125906143, 'mean_word_length': 2.9273408239700376, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3244524', 'n_tokens_mistral': 1784, 'n_tokens_neox': 1637, 'n_words': 369}