This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const handleScroll = () => { | |
| const pageYOffset = window.pageYOffset; | |
| const windowHeight = window.innerHeight; | |
| const elementOffsetTop = ref?.current?.offsetTop ?? 0; | |
| const elementHeight = ref?.current?.offsetHeight ?? 0; | |
| const scrollDirectionToTop = pageYOffset < prevPageYOffset.current; | |
| const distanceFromTop = pageYOffset + elementOffsetTop; | |
| const inViewport = | |
| pageYOffset >= elementOffsetTop - windowHeight && | |
| pageYOffset <= elementOffsetTop + elementHeight; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # 1. | |
| # Code Quality Check | |
| # @scope ./react | |
| # | |
| STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM "src/react/*.js" "react/*.jsx" | tr '\n' ' ') | |
| ESLINT="$(git rev-parse --show-toplevel)/react/node_modules/.bin/eslint" | |
| [ -z "$STAGED_FILES" ] && exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var IputEffect = function(){ | |
| var placeholderPosition, appendInputWhenSelect, actions; | |
| actions = { | |
| activate: function(el) { | |
| el.parentNode.parentNode.addClass('active'); | |
| }, | |
| deactivate: function(el) { | |
| if (el.value === '') el.parentNode.parentNode.removeClass('active'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '2' | |
| services: | |
| db: | |
| container_name: database | |
| image: mariadb # Pull mysql image from Docker Hub | |
| ports: # Set up ports exposed for other containers to connect to | |
| - "3306:3306" | |
| volumes: | |
| - ./dep/mysql:/docker-entrypoint-initdb.d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var PhotoSwipe = require('photoswipe'); | |
| var PhotoSwipeUIDefault = require('photoswipe/dist/photoswipe-ui-default'); | |
| (function() { | |
| var initPhotoSwipeFromDOM = function(gallerySelector) { | |
| var div = document.createElement('div'); | |
| div.innerHTML = `<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true"> | |
| <div class="pswp__bg"></div> | |
| <div class="pswp__scroll-wrap"> | |
| <div class="pswp__container"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var scrollDirectionPrevValue = 0; | |
| // Function return: | |
| // true - scroll bottom | |
| // false - scroll top | |
| function scrollDirectionToBottom(scrollTop){ | |
| var directionToBottom = false; | |
| if( scrollDirectionPrevValue < scrollTop ) directionToBottom = true; | |
| scrollDirectionPrevValue = scrollTop; | |
| return directionToBottom; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function generateRandomBetween(min, max){ | |
| var y = Math.floor(Math.random()*(max-min + 1) + min); | |
| return y; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.fn.inViewport = function(){ | |
| var win = $(window); | |
| var self = $(this); | |
| var posOnPage = win.scrollTop(); | |
| var selfOffset = self.offset().top; | |
| var visiblePartOfpage = posOnPage + win.height(); | |
| var endOfElPos = selfOffset + self.outerHeight(); | |
| return (visiblePartOfpage >= selfOffset && visiblePartOfpage <= endOfElPos ? true : false); | |
| } |