Helper function to test if an element overlaps others
779792
function(elem, other_elems) {
                    // Pairwise overlap detection
                    var overlapping = function(a, b) {
                        if (Math.abs(2.0*a.offsetLeft + a.offsetWidth - 2.0*b.offsetLeft - b.offsetWidth) < a.offsetWidth + b.offsetWidth) {
                            if (Math.abs(2.0*a.offsetTop + a.offsetHeight - 2.0*b.offsetTop - b.offsetHeight) < a.offsetHeight + b.offsetHeight) {
                                return true;
                            }
                        }
                        return false;
                    };
                    var i = 0;
                    // Check elements for overlap one by one, stop and return false as soon as an overlap is found
                    for(i = 0; i < other_elems.length; i++) {
                        if (overlapping(elem, other_elems[i])) {
                            return true;
                        }
                    }
                    return false;
                }
56056
def _check_overlap(self, fragment):
        
        #
        # NOTE bisect does not work if there is a configuration like:
        #
        #      *********** <- existing interval
        #           ***    <- query interval
        #
        # TODO one should probably check this by doing bisect
        #      over the begin and end lists separately
        #
        for existing_fragment in self.fragments:
            if existing_fragment.interval.relative_position_of(fragment.interval) not in self.ALLOWED_POSITIONS:
                self.log_exc(u"interval overlaps another already present interval", None, True, ValueError)
874746
function getOverlapArea(topLeft1, bottomRight1, topLeft2, bottomRight2) {
  // If no overlap, return 0
  if ((topLeft1.x > bottomRight2.x || bottomRight1.x < topLeft2.x) || (topLeft1.y > bottomRight2.y || bottomRight1.y < topLeft2.y)) {
    return 0;
  }
  // return overlapping area : [ min of rightmost/bottommost co-ordinates ] - [ max of leftmost/topmost co-ordinates ]
  return ((Math.min(bottomRight1.x, bottomRight2.x) - Math.max(topLeft1.x, topLeft2.x)) * (Math.min(bottomRight1.y, bottomRight2.y) - Math.max(topLeft1.y, topLeft2.y)));
}
1060827
def overlaps?(other)
      max_seconds = TimeOfDay::NUM_SECONDS_IN_DAY

      # Standard case, when Shifts are on the same day
      a, b = [self, other].map(&:range).sort_by(&:first)
      op = a.exclude_end? ? :> : :>=
      return true if a.last.send(op, b.first)

      # Special cases, when Shifts span to the next day
      return false if (a.last < max_seconds) && (b.last < max_seconds)

      a = Range.new(a.first, a.last - max_seconds, a.exclude_end?) if a.last > max_seconds
      b = Range.new(b.first, b.last - max_seconds, b.exclude_end?) if b.last > max_seconds
      a, b = [a, b].sort_by(&:last)
      b.last.send(op, a.last) && a.last.send(op, b.first)
    end
27329
def overlaps(self, other):
        
        if self.chrom != other.chrom: return False
        if self.start >= other.end: return False
        if other.start >= self.end: return False
        return True
851307
function(one, two) {
        if (one.tag != two.tag) {
            return false;
        } else if (one.text.trim() != two.text.trim()) {
            return false;
        } else if (one._children.length != two._children.length) {
            return false;
        }

        if (!attribMatch(one, two)) return false;

        for (var i = 0; i < one._children.length; i++) {
            if (!module.exports.equalNodes(one._children[i], two._children[i])) {
                return false;
            }
        }

        return true;
    }
146833
public final boolean overlaps(long position, long size) {
        if (position + size <= this.position)
            return false;               // That is below this
        if (this.position + this.size <= position)
            return false;               // This is below that
        return true;
    }
452070
public final boolean overlaps(@NotNull final HourRange other) {
        Contract.requireArgNotNull("other", other);
        if (this.equals(other)) {
            return true;
        }
        final int otherFrom = other.from.toMinutes();
        final int thisFrom = from.toMinutes();
        final int otherTo = other.to.toMinutes();
        final int thisTo = to.toMinutes();
        if (otherFrom <= thisTo && otherFrom >= thisFrom) {
            return true;
        }
        if (otherTo <= thisTo && otherTo >= thisFrom) {
            return true;
        }
        if (thisFrom <= otherTo && thisFrom >= otherFrom) {
            return true;
        }
        return (thisTo <= otherTo && thisTo >= otherFrom);
    }
476729
def overlaps(self, other):
        """"""
        return self.network in other or self.broadcast in other or (
            other.network in self or other.broadcast in self)
1132853
function() {
  if (!global.document) {
    return true;
  }
  return global.document.documentElement.compareDocumentPosition ?
    function (a, b) {
      return !!(a.compareDocumentPosition(b) & 16);
    } :
    global.document.documentElement.contains ?
      function (a, b) {
        return a !== b && ( a.contains ? a.contains(b) : false );
      } :
      function (a, b) {
        while (b = b.parentNode) {
          if (b === a) {
            return true;
          }
        }
        return false;
      };
}
141659
def overlap(self, value):
        
        if value == 0:
            self._element._remove_overlap()
            return
        self._element.get_or_add_overlap().val = value
706465
def overlaps(self, canvas, exclude=[]):
        
        try:
            exclude = list(exclude)
        except TypeError:
            exclude = [exclude]
        exclude.append(self)

        for selfY, row in enumerate(self.image.image()):
            for selfX, pixel in enumerate(row):
                canvasPixelOn = canvas.testPixel(
                    (selfX + self.position[0], selfY + self.position[1]),
                    excludedSprites=exclude
                )
                if pixel and canvasPixelOn:
                    return True
        return False
34737
def overlaps(self,junc,tolerance=0):
    """"""
    if not self.left.overlaps(junc.left,padding=tolerance): return False
    if not self.right.overlaps(junc.right,padding=tolerance): return False
    return True
115786
function checkCircles( bodyA, bodyB ){

        var scratch = Physics.scratchpad()
            ,d = scratch.vector()
            ,tmp = scratch.vector()
            ,overlap
            ,collision = false
            ;

        d.clone( bodyB.state.pos )
            .vadd( bodyB.getGlobalOffset( tmp ) )
            .vsub( bodyA.state.pos )
            .vsub( bodyA.getGlobalOffset( tmp ) ) // save offset for later
            ;
        overlap = d.norm() - (bodyA.geometry.radius + bodyB.geometry.radius);

        // hmm... they overlap exactly... choose a direction
        if ( d.equals( Physics.vector.zero ) ){

            d.set( 1, 0 );
        }

        if ( overlap <= 0 ){

            collision = {
                bodyA: bodyA,
                bodyB: bodyB,
                norm: d.normalize().values(),
                mtv: d.mult( -overlap ).values(),
                pos: d.mult( -bodyA.geometry.radius/overlap ).vadd( tmp ).values(),
                overlap: -overlap
            };
        }

        return scratch.done( collision );
    }
1216806
def contains(self, other):
        
        return (self.left <= other.left and
                self.right >= other.right and
                self.top >= other.top and
                self.bottom <= other.bottom)
1043952
function matches(elem, selector) {
  // We'll use querySelectorAll to find all element matching the selector,
  // then check if the given element is included in that list.
  // Executing the query on the parentNode reduces the resulting nodeList,
  // document doesn't have a parentNode, though.
  var nodeList = ( elem.parentNode || document ).querySelectorAll( selector ) || [],
      i = nodeList.length;

  // loop on the nodeList
  while ( i-- ) {
    if ( nodeList[i] == elem ) { return true; }
  }
  return false;
}
51866
function hasInterpolatingAmpersand(selector) {
  for (let i = 0, l = selector.length; i < l; i++) {
    if (selector[i] !== "&") {
      continue;
    }

    if (!_.isUndefined(selector[i - 1]) && !isCombinator(selector[i - 1])) {
      return true;
    }

    if (!_.isUndefined(selector[i + 1]) && !isCombinator(selector[i + 1])) {
      return true;
    }
  }

  return false;
}