Skip to content

Instantly share code, notes, and snippets.

View SychovOleh's full-sized avatar

Oleh Sychov SychovOleh

  • Krakow, Poland
  • 20:16 (UTC +01:00)
View GitHub Profile
@SychovOleh
SychovOleh / start-mongo-replset.sh
Created December 12, 2020 16:04 — forked from leetreveil/start-mongo-replset.sh
Shell scripts to create a mongodb replica set and sharded cluster locally
#!/bin/bash
# shell script to create a simple mongodb replica set (tested on osx)
set -euo pipefail
base_path="/System/Volumes/Data/data"
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
This file has been truncated, but you can view the full file.
column1,column2
column1,column2
column1,column2
column1,column2
column1,column2
column1,column2
column1,column2
column1,column2
column1,column2
column1,column2
This file has been truncated, but you can view the full file.
column1,column2
column1,column2
column1,column2
column1,column2
column1,column2
column1,column2
column1,column2
column1,column2
column1,column2
column1,column2
@SychovOleh
SychovOleh / Find element for animaiton
Last active September 3, 2017 06:31
Find element for animaiton
const isElementInViewport = (elem, animateSveralTimes) => {
let $elem = $(elem);
// Get the scroll position of the page.
let scrollElem = ((navigator.userAgent.toLowerCase().indexOf('webkit') != -1) ? 'body' : 'html');
let viewportTop = $(scrollElem).scrollTop();
let viewportBottom = viewportTop + $(window).height();
// Get the position of the element on the page.
let elemTop = Math.round($elem.offset().top);
function drawNestedSetsTree(data, node) {
const isEmpty = arr => arr.length === 0 ? true : false;
if (!Array.isArray(data) || isEmpty(data) ||
!node || node === null) {
return;
}
//
let dataCopy = data.slice();
const listContainer = 'ul';
git reset --soft HEAD~1 // reset pushed commit
git init // create
git add . // add files
git status
git log
git commit -m "first commit"
const topWalker = (node, testFunc, lastParent) => {
while (node && targetNode !== lastParent) {
if (testFunc(node)) {
return node;
}
node = node.parentNode;
}
}
const getLink = (node) => {
return topWalker(node, (node) => node.nodeName === 'A')
function drawNestedSetsTree(data, node) {
function isEmpty(obj) {
if (obj == null) return true;
if (obj.length > 0) return false;
if (obj.length === 0) return true;
if (typeof obj !== "object") return true;
for (var key in obj) {
if (hasOwnProperty.call(obj, key)) return false;
}
return true;