Skip to content

Instantly share code, notes, and snippets.

View dan-maximov's full-sized avatar
🎯
Focusing

Daniel Maximov dan-maximov

🎯
Focusing
View GitHub Profile
@dan-maximov
dan-maximov / chunk-array.js
Last active April 19, 2019 05:22
chunk array
const getChunks = (arr, size) => {
const sets = [];
const chunks = arr.length / size;
let i = 0;
while (i < chunks) {
sets[i] = arr.splice(0, size);
i++;
}
const asyncForEach = async (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array);
}
}
@dan-maximov
dan-maximov / Accordeon.jsx
Created August 29, 2019 10:24
JS-less React Accordeon
import React from 'react';
import styled from 'styled-components';
const Header = styled.label`
cursor: pointer;
`;
const Title = styled.p`
`;
@dan-maximov
dan-maximov / .p10k.zsh
Last active September 12, 2019 13:24
my terminal settings
# Generated by Powerlevel10k configuration wizard on 2019-09-07 at 14:42 EEST.
# Based on romkatv/powerlevel10k/config/p10k-lean.zsh, checksum 16947.
# Wizard options: nerdfont-complete + powerline, small icons, lean, time, 1 line,
# compact, many icons, concise.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with classic powerline prompt style. Type `p10k configure` to generate
# your own config based on it.
#
# Tip: Looking for a nice color? Here's a one-liner to print colormap.
@dan-maximov
dan-maximov / addAllSongsOfPageToBookmarks.js
Created July 26, 2020 16:16
Add all songs to bookmarks from BSaber songs list
function addAllSongsOfPageToBookmarks() {
const queue = Array.from(document.querySelectorAll('[data-type="add_bookmark"]'));
let i = 0;
const intervalId = setInterval(() => {
if (!queue.length) {
clearInterval(intervalId);
console.log(`there's no songs to add to bookmark from this page`);
return;
};
const e = queue.pop();