Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Viktor19931's full-sized avatar
🎯
Focusing on web and REST api

Viktor Hardubej Viktor19931

🎯
Focusing on web and REST api
View GitHub Profile
@Viktor19931
Viktor19931 / scroll-polyfill
Created December 3, 2019 15:24
scroll-polyfill
(function ScrollPolyfill() {
// The asynchronous tester
// wrapped in an iframe (will not work in SO's StackSnippet®)
var iframe = document.createElement('iframe');
iframe.onload = function() {
var win = iframe.contentWindow;
// listen for a scroll event
win.addEventListener('scroll', function handler(e){
open -a Google\ Chrome --args --disable-web-security --user-data-dir
@Viktor19931
Viktor19931 / test.js
Last active May 2, 2019 11:46
merge two arrays and make data uniq by id
const mergeArray = (arr1, arr2) => {
let arr = [...arr1, ...arr2]
const uniqueArr = arr
.map(e => e.id)
.map((e, i, keysArr) => keysArr.indexOf(e) === i && i)
.filter(e => arr[e]).map(e => arr[e]);
return uniqueArr;