<commit_before>/**
 * Globals
 */
var events = _.clone(Backbone.Events);

var gitEngine = null;
var gitVisuals = null;

var commandCollection = null;
var commandBuffer = null;
var animationFactory = null;

var paper = null;

$(document).ready(function(){
  animationFactory = new AnimationFactory();

  // the two major collections that affect everything
  var commitCollection = new CommitCollection();  
  commandCollection = new CommandCollection();
  var branchCollection = new BranchCollection();

  commandBuffer = new CommandBuffer({
    collection: commandCollection
  });

  // TODO make not global
  commandPromptView = new CommandPromptView({
    el: $('#commandLineBar'),
    collection: commandCollection
  });
  commandLineHistoryView = new CommandLineHistoryView({
    el: $('#commandLineHistory'),
    collection: commandCollection
  });

  gitVisuals = new GitVisuals({
    commitCollection: commitCollection,
    branchCollection: branchCollection
  });

  gitEngine = new GitEngine({
    collection: commitCollection,
    branches: branchCollection
  });

  $('#commandTextField').focus();

  // make the canvas for us
  Raphael(10, 10, 200, 200, function() {
    paper = this;
    // needs to be called before raphael ready
    windowResize();
    events.trigger('raphaelReady');
  });

  $(window).resize(windowResize);
  windowResize();
  setTimeout(windowResize, 50);

  
  if (/\?demo/.test(window.location.href)) {
    setTimeout(function() {
      events.trigger('submitCommandValueFromEvent', "gc; git checkout HEAD~1; git commit; git checkout -b bugFix; gc; gc; git rebase master; git checkout master; gc; gc; git merge bugFix");
    }, 500);
  }
});

function windowResize() {
  var smaller = 10;

  if (paper && paper.canvas) {
    var el = $('#canvasWrapper')[0];

    var left = el.offsetLeft;
    var top = el.offsetTop;
    var width = el.clientWidth - smaller;
    var height = el.clientHeight - smaller;

    $(paper.canvas).css({
      left: left + 'px',
      top: top + 'px'
    });
    paper.setSize(width, height);
    events.trigger('canvasResize', width, height);
  }
}

<commit_msg>ok now it blocks on raphael load<commit_after>/**
 * Globals
 */
var events = _.clone(Backbone.Events);

var gitEngine = null;
var gitVisuals = null;

var commandCollection = null;
var commandBuffer = null;
var animationFactory = null;

var paper = null;

$(document).ready(function(){
  // static classes
  animationFactory = new AnimationFactory();
  commandCollection = new CommandCollection();

  commandBuffer = new CommandBuffer({
    collection: commandCollection
  });

 // TODO make not global
  commandPromptView = new CommandPromptView({
    el: $('#commandLineBar'),
    collection: commandCollection
  });
  commandLineHistoryView = new CommandLineHistoryView({
    el: $('#commandLineHistory'),
    collection: commandCollection
  });

  // make the canvas for us
  Raphael(10, 10, 200, 200, function() {
    paper = this;

    // the two major collections that affect everything
    var commitCollection = new CommitCollection();  
    var branchCollection = new BranchCollection();

    gitVisuals = new GitVisuals({
      commitCollection: commitCollection,
      branchCollection: branchCollection
    });

    gitEngine = new GitEngine({
      collection: commitCollection,
      branches: branchCollection
    });

    $('#commandTextField').focus();

    // needs to be called before raphael ready
    windowResize();
    events.trigger('raphaelReady');
  });

  $(window).resize(windowResize);
  windowResize();
  setTimeout(windowResize, 50);
  
  if (/\?demo/.test(window.location.href)) {
    setTimeout(function() {
      events.trigger('submitCommandValueFromEvent', "gc; git checkout HEAD~1; git commit; git checkout -b bugFix; gc; gc; git rebase master; git checkout master; gc; gc; git merge bugFix");
    }, 500);
  }
});

function windowResize() {
  var smaller = 10;
  var el = $('#canvasWrapper')[0];

  var left = el.offsetLeft;
  var top = el.offsetTop;
  var width = el.clientWidth - smaller;
  var height = el.clientHeight - smaller;

  if (paper && paper.canvas) {
    $(paper.canvas).css({
      left: left + 'px',
      top: top + 'px'
    });
    paper.setSize(width, height);
  }
  events.trigger('canvasResize', width, height);
}


{'fraction_non_alphanumeric': 0.1278772378516624, 'fraction_numerical': 0.008835154615205766, 'mean_word_length': 3.61587982832618, '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': '7336633', 'n_tokens_mistral': 1278, 'n_tokens_neox': 1231, 'n_words': 354}