Skip to content

Instantly share code, notes, and snippets.

View xto3na's full-sized avatar

Sergey Ponomarenko xto3na

  • Dnepropetrovsk, Ukraine
View GitHub Profile
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);
}
document.getElementById("selectId").selectedIndex = 2;
// or
document.querySelector('#select').value = 'neededValue';
@xto3na
xto3na / setSameHeight.js
Created July 15, 2019 09:01
Set Same Height
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 February 26, 2019 11:18
Drag-n-drop_slider
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
@xto3na
xto3na / Scroll_styling.scss
Last active February 18, 2019 13:11
Scroll_Styling
.scrollable-container {
&::-webkit-scrollbar {
-webkit-appearance: none;
}
&::-webkit-scrollbar:vertical {
width: 12px;
}
&::-webkit-scrollbar:horizontal {
height: 12px;
}
@xto3na
xto3na / delete_local_branch.txt
Created February 13, 2019 14:45
Delete local branch
git branch -d branch-after-fail-merge
@xto3na
xto3na / git_merge--abort
Created February 1, 2019 09:21
git_merge--abort.txt
git merge --abort
@xto3na
xto3na / ScrollTrigger.js
Created January 16, 2019 09:21
ScrollTrigger.js
/* First argument: horizontal coordinate(X),
Second argument: vertical coordinate(Y)*/
window.scrollTo(0, 583);
@xto3na
xto3na / ST3-Settings-Plugins
Last active January 10, 2019 12:36
ST3-Settings-Plugins
ST3-Settings-Plugins
@xto3na
xto3na / masonry.html
Last active October 11, 2018 14:30
Masonry grid CSS
<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;