<commit_before>(function(){

  $(window).scroll(function(){
    var stickyClass = ['.sticky-cell', '.sticky-wrapper'],
        stuckClass  = ['stuck-top', 'stuck-lower'],
        scroll      = getCurrentScroll(),
        $hedHght    = $('header').height(), // or integer
        $stkHght    = $(stickyClass[0]).outerHeight(),
        $stkWrp     = $(stickyClass[1]).height();

    if(scroll >= $hedHght) {
      $(stickyClass[0]).addClass(stuckClass[0]);
      if(scroll >= $stkWrp - $stkHght + $hedHght) { //$hedHeight is the header offset
        $(stickyClass[0]).removeClass(stuckClass[0]).addClass(stuckClass[1]);
      } else {
        $(stickyClass[0]).removeClass(stuckClass[1]).addClass(stuckClass[0]);
      }
    } else {
      $(stickyClass[0]).removeClass(stuckClass[0]);
    }
  });

  function getCurrentScroll() {
    return window.pageYOffset;
  }

})();<commit_msg>streamlines variables<commit_after>(function(){

  $(window).scroll(function(){
    var stickyClass = ['.sticky-cell', '.sticky-wrapper'],
        stuckClass  = ['stuck-top', 'stuck-lower'],
        scroll      = getCurrentScroll(),
        $hedHght    = $('header').height(), // add more here if needed e.g ' + $('element').height()'
        $heights    = $(stickyClass[1]).height() - $(stickyClass[0]).outerHeight() + $hedHght;

    if(scroll >= $hedHght) {
      $(stickyClass[0]).addClass(stuckClass[0]);
      if(scroll >= $heights) {
        $(stickyClass[0]).removeClass(stuckClass[0]).addClass(stuckClass[1]);
      } else {
        $(stickyClass[0]).removeClass(stuckClass[1]).addClass(stuckClass[0]);
      }
    } else {
      $(stickyClass[0]).removeClass(stuckClass[0]);
    }
  });

  function getCurrentScroll() {
    return window.pageYOffset;
  }

})();
{'fraction_non_alphanumeric': 0.19794637763833428, 'fraction_numerical': 0.013690815744438107, 'mean_word_length': 3.1270588235294117, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4845961', 'n_tokens_mistral': 581, 'n_tokens_neox': 577, 'n_words': 79}