Skip to content

Instantly share code, notes, and snippets.

Avatar

Sergey Ponomarenko xto3na

  • Dnepropetrovsk, Ukraine
View GitHub Profile
View threePlusOne.js
function threePlusOne(number) {
console.info(number);
if(number === 1 || number === 0) {
return number;
} else {
if(number%2) {
threePlusOne(number * 3 + 1);
} else {
threePlusOne(number / 2);
}
View change-select-from-js.js
document.getElementById("selectId").selectedIndex = 2;
// or
document.querySelector('#select').value = 'neededValue';
View setSameHeight.js
export function setSameHeight(selector) { // Делает высоту всех элементов по селектору как у самого высокого
let arrayOfElements = document.querySelectorAll(selector);
let maxHeight = 0;
if(arrayOfElements.length > 0) {
for(let i = arrayOfElements.length - 1; i >= 0; i--) {
let heightOfElement = arrayOfElements[i].getBoundingClientRect().height;
if(maxHeight < heightOfElement) {
maxHeight = heightOfElement;
}
}
@xto3na
xto3na / Drag-n-drop_slider.html
Last active Feb 26, 2019
Drag-n-drop_slider
View Drag-n-drop_slider.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
View Scroll_styling.scss
.scrollable-container {
&::-webkit-scrollbar {
-webkit-appearance: none;
}
&::-webkit-scrollbar:vertical {
width: 12px;
}
&::-webkit-scrollbar:horizontal {
height: 12px;
}
View delete_local_branch.txt
git branch -d branch-after-fail-merge
@xto3na
xto3na / git_merge--abort
Created Feb 1, 2019
git_merge--abort.txt
View git_merge--abort
git merge --abort
View ScrollTrigger.js
/* First argument: horizontal coordinate(X),
Second argument: vertical coordinate(Y)*/
window.scrollTo(0, 583);
@xto3na
xto3na / ST3-Settings-Plugins
Last active Jan 10, 2019
ST3-Settings-Plugins
View ST3-Settings-Plugins
ST3-Settings-Plugins
@xto3na
xto3na / masonry.html
Last active Oct 11, 2018
Masonry grid CSS
View masonry.html
<style>
.masonry-layout {
column-count: 3;
-webkit-column-count: 3;
column-gap: 0;
-webkit-column-gap: 0;
}
.masonry-layout_item {
break-inside: avoid;
-webkit-column-break-inside: avoid;