<commit_before>(function( $ ) {

  $.fn.aeImageResize = function( params ) {

    // We cannot do much unless we have one of these
    if ( !params.height && !params.width ) {
      return this;
    }

    var mathFloor = Math.floor
      ,	isIE6 = $.browser.msie && (parseInt($.browser.version) == 6)
      ,	aspectRatio = 0
      ;

    // Calculate aspect ratio now, if possible
    if ( params.height && params.width ) {
      aspectRatio = params.width / params.height;
    }

    // Attach handler to load
    // Handler is executed just once per element
    // Load event required for Webkit browsers
    return this.one( "load", function() {

      // Remove all attributes and CSS rules
      this
        .removeAttr( "height" )
        .removeAttr( "width" )
        .css({
          height: "",
          width: ""
        });

      var imgHeight = this.height
        ,	imgWidth = this.width
        ,	imgAspectRatio = imgWidth / imgHeight
        ,	bxHeight = params.height
        ,	bxWidth = params.width
        ,	bxAspectRatio = aspectRatio;
				
      // Work the magic!
      // If one parameter is missing, we just force calculate it
      if ( !bxAspectRatio ) {
        if ( bxHeight === 0 ) {
          bxAspectRatio = imgAspectRatio - 1;
        } else {
          bxAspectRatio = imgAspectRatio + 1;
        }
      }

      // Only resize the images that need resizing
      if ( (bxHeight && imgHeight > bxHeight) || (bxWidth && imgWidth > bxWidth) ) {

        if ( imgAspectRatio > aspectRatio ) {
          bxHeight = mathFloor( imgHeight / imgWidth * bxWidth );
        } else {
          bxWidth = mathFloor( imgWidth / imgHeight * bxHeight );
        }

        $( this ).attr({
          "height": bxHeight,
          "width": bxWidth
        });
      }
    })
    .each(function() {

      // Trigger load event (for Gecko and MSIE)
      if ( this.complete || isIE6 ) {
        this.trigger( "load" );
      }
    });
  };
})( jQuery );<commit_msg>~~ is a nice equivalent for ParseInt & Math.floor<commit_after>(function( $ ) {

  $.fn.aeImageResize = function( params ) {

    // We cannot do much unless we have one of these
    if ( !params.height && !params.width ) {
      return this;
    }

    var aspectRatio = 0
      // Nasty I know but its done only once, so not to bad I guess
      // Alternate suggestions welcome :)
      ,	isIE6 = $.browser.msie && (6 == ~~ $.browser.version)
      ;

    // Calculate aspect ratio now, if possible
    if ( params.height && params.width ) {
      aspectRatio = params.width / params.height;
    }

    // Attach handler to load
    // Handler is executed just once per element
    // Load event required for Webkit browsers
    return this.one( "load", function() {

      // Remove all attributes and CSS rules
      this
        .removeAttr( "height" )
        .removeAttr( "width" )
        .css({
          height: "",
          width: ""
        });

      var imgHeight = this.height
        ,	imgWidth = this.width
        ,	imgAspectRatio = imgWidth / imgHeight
        ,	bxHeight = params.height
        ,	bxWidth = params.width
        ,	bxAspectRatio = aspectRatio;
				
      // Work the magic!
      // If one parameter is missing, we just force calculate it
      if ( !bxAspectRatio ) {
        if ( bxHeight === 0 ) {
          bxAspectRatio = imgAspectRatio - 1;
        } else {
          bxAspectRatio = imgAspectRatio + 1;
        }
      }

      // Only resize the images that need resizing
      if ( (bxHeight && imgHeight > bxHeight) || (bxWidth && imgWidth > bxWidth) ) {

        if ( imgAspectRatio > aspectRatio ) {
          bxHeight = ~~ ( imgHeight / imgWidth * bxWidth );
        } else {
          bxWidth = ~~ ( imgWidth / imgHeight * bxHeight );
        }

        $( this ).attr({
          "height": bxHeight,
          "width": bxWidth
        });
      }
    })
    .each(function() {

      // Trigger load event (for Gecko and MSIE)
      if ( this.complete || isIE6 ) {
        this.trigger( "load" );
      }
    });
  };
})( jQuery );
{'fraction_non_alphanumeric': 0.11793611793611794, 'fraction_numerical': 0.0034398034398034397, 'mean_word_length': 1.7322147651006712, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 9, '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': '2818378', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1188, 'n_words': 346}