<commit_before>// use lodash instead of underscore
// https://github.com/meteor/meteor/issues/1009
_ = lodash;

Utilities = {

  getBitDataId: function (bitHtmlElement){
    // TODO: improve so either an HTML element/node, or a jQuery obj works.
    // Greensock does this, look at source
    return $(bitHtmlElement).data('id');
  },

  getBitElement: function (bitDatabaseId){
    return $("[data-id='" + bitDatabaseId + "']");
  },

  getBitTemplate: function (bitId){
    var $bit = this.getBitElement(bitId);
    return Blaze.getView( _.first($bit) );
  },

  // person interacts with only one map at a time, ie singleton obj 
  getMapTemplate: function (){
    var mapElement = _.first( $(".map") );
    var mapView = Blaze.getView( mapElement );
    return mapView.templateInstance();
  },

  // Usually, we'd just use jQuery's .position method.
  // In situations where the element is display:none, we can use the transform 
  // property, if it's set, to get the position 
  getTransformedPosition: function(element){
    var cssTransform = element.style["transform"];
    var pattern = /[,();]|(px)|(em)|(rem)|(translate)|(matrix)|(3d)/gi;

    // slice + dice the string with a regexp to remove everything except
    // for number values. Split the string into an array.<commit_msg>bit:shimmer- fixing Safari bug<commit_after>// use lodash instead of underscore
// https://github.com/meteor/meteor/issues/1009
_ = lodash;

Utilities = {

  getBitDataId: function (bitHtmlElement){
    // TODO: improve so either an HTML element/node, or a jQuery obj works.
    // Greensock does this, look at source
    return $(bitHtmlElement).data('id');
  },

  getBitElement: function (bitDatabaseId){
    return $("[data-id='" + bitDatabaseId + "']");
  },

  getBitTemplate: function (bitId){
    var $bit = this.getBitElement(bitId);
    return Blaze.getView( _.first($bit) );
  },

  // person interacts with only one map at a time, ie singleton obj 
  getMapTemplate: function (){
    var mapElement = _.first( $(".map") );
    var mapView = Blaze.getView( mapElement );
    return mapView.templateInstance();
  },

  // Usually, we'd just use jQuery's .position method.
  // In situations where the element is display:none, we can use the transform 
  // property, if it's set, to get the position 
  getTransformedPosition: function(element){
    var cssTransform = element.style["transform"] || element.style["webkitTransform"];
    var pattern = /[,();]|(px)|(em)|(rem)|(translate)|(matrix)|(3d)/gi;

    // slice + dice the string with a regexp to remove everything except
    // for number values. Split the string into an array.
{'fraction_non_alphanumeric': 0.1367942402425161, 'fraction_numerical': 0.0037893141341417205, 'mean_word_length': 3.5205479452054793, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1752945', 'n_tokens_mistral': 815, 'n_tokens_neox': 774, 'n_words': 255}