Skip to content

Instantly share code, notes, and snippets.

View vpodk's full-sized avatar
💻
Coding ...

Valentin Podkamennyi vpodk

💻
Coding ...
View GitHub Profile
/**
* Binary search is a search algorithm that finds the position of a target value within a sorted array.
* Binary search has O(log n) complexity.
* @param {!Array} list The sorted array.
* @param {*} item The item to search.
* @return {number} Returns the index of the item in the array.
* @see https://en.wikipedia.org/wiki/Binary_search_algorithm
*/
const binarySearch = (list, item) => {
let low = 0;
@vpodk
vpodk / clap-nav-theme.css
Created April 27, 2020 02:25
Clean Application - Hamburger Menu
nav ul,
nav a {
background-color: Indigo;
color: White;
}
nav .menu a.active,
nav .menu a:active,
nav .menu a:hover {
background-color: DarkMagenta;
@vpodk
vpodk / clap-nav.css
Created April 27, 2020 02:24
Clean Application - Hamburger Menu
nav {
display: block;
float: right;
left: -1em;
padding-top: .2em;
position: absolute;
user-select: none;
width: 100%;
z-index: 1;
-webkit-user-select: none;
@vpodk
vpodk / clap-nav-index.html
Created April 27, 2020 02:23
Clean Application - Hamburger Menu
<header>
<h1>Header</h1>
<nav id="nav">
<input type="checkbox" aria-label="Toggle menu">
<div class="hamburger"><span></span></div>
<ul class="menu">
<li><a href="./index.html">Home</a></li>
<li><a href="./index.html">About</a></li>
<li><a href="./index.html">Contact</a></li>
</ul>
@vpodk
vpodk / clap-positions-app.css
Created April 20, 2020 01:47
Clean Application - Block Positions
body {
font-family: arial, sans-serif;
-webkit-font-smoothing: antialiased;
}
#main {
margin: 5em auto 0;
}
header,
@vpodk
vpodk / clap-layout-theme.css
Last active April 20, 2020 01:33
Clean Application — Flexible Box Layout
body {
background-color: White;
color: DarkSlateGray;
}
header,
footer {
background-color: Indigo;
color: White;
}
#main > aside {
@vpodk
vpodk / clap-layout-flex-update.css
Last active April 20, 2020 01:34
Clean Application — Flexible Box Layout
aside, footer, header, #main > article {
padding: 1em;
}
@vpodk
vpodk / clap-layout-index.html
Last active April 20, 2020 01:32
Clean Application — Flexible Box Layout
<body>
<header>Header</header>
<div id="main">
<article>Content</article>
<aside>Left sidebar</aside>
<aside>Right sidebar</aside>
</div>
<footer>Footer</footer>
</body>
@vpodk
vpodk / clap-layout-flex.css
Last active April 20, 2020 01:34
Clean Application — Flexible Box Layout
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
display: flex;
flex-direction: column;
min-height: 100vh;
@vpodk
vpodk / merge-sorted-arrays.js
Last active March 12, 2024 01:19
Given two sorted arrays, merge them into a new array that is also sorted.
/**
* Merge two sorted integer arrays nums1 and nums2 into nums1, sorted in non-decreasing order.
* The time complexity of this function is O(m + n),
* @param {number[]} nums1 The first sorted array containing elements to be merged.
* @param {number} m The number of elements in nums1 (excluding additional space for merging).
* @param {number[]} nums2 The second sorted array containing elements to be merged into nums1.
* @param {number} n The number of elements in nums2.
* @see https://leetcode.com/problems/merge-sorted-array/
*/
var merge = function(nums1, m, nums2, n) {