Skip to content

Instantly share code, notes, and snippets.

View BiosBoy's full-sized avatar
⛰️
The bigger you know - the less you scared of.

Sviat Kuzhelev BiosBoy

⛰️
The bigger you know - the less you scared of.
View GitHub Profile
const input1 = [1, 2, 5, 3, 4, 7, 8, 6];
const input2 = [2, 5, 1, 3, 4];
const chaos = (arr) => {
let operationCount = 0;
let isChaos = false;
arr.forEach((_, idx) => {
const nextReversedIdx = arr.length - idx;
const currentReversedIndex = nextReversedIdx - 1;
const rotLeft = (a, d) => {
const rotArr = [...Array(d).keys()];
rotArr.forEach(() => a.push(...a.splice(0, 1)));
return a;
};
console.log(rotLeft([1, 2, 3, 4, 5], 4));
const arr = [
[1, 1, 1, 0, 0, 0],
[0, 1, 0, 0, 0, 0],
[1, 1, 1, 0, 0, 0],
[0, 0, 2, 4, 4, 0],
[0, 0, 0, 2, 0, 0],
[0, 0, 1, 2, 4, 0],
];
const SHIFT_MAX = 3;
class MyPromise {
constructor(fn) {
this._promiseChain = [];
fn(this._onResolve, this._onReject);
}
then = (handleSuccess) => {
this._promiseChain.push(handleSuccess);
const fs = require('fs');
const path = require('path');
const data = fs.readFileSync(path.join(__dirname, './input8.txt'), 'utf8');
const arr = data.split('\n').map(item => item.split(''));
const treesBoxCount = 16;
const trees = [...Array.from(Array(arr.length - 1).keys()).map(() => [])];
// const fs = require('fs');
// const path = require('path');
// const data = fs.readFileSync(path.join(__dirname, './input4.txt'), 'utf8');
// const rules = fs.readFileSync(path.join(__dirname, './input4_1.txt'), 'utf8');
const input = 'pnnfhnhshrhmhwwmwzmznmnwmwfmfhfjfcjjtgtbggpdgdjjbjrjsjpjrrmddmgmpmddrhddnfnfzfpfvpfpprhhlffmtffqhhdtdcdsswsdwswmmfvvpdprrnnhhhtffnfbbznbznnvdnnbffjrfrbfrbrgbrrntnggrqqwtqwwgjgsswgwqwtwwsvwvbwvwrwlrlppzfzwfzzpmzzhqqzqlzlglzzmrmwrmwwvmwvvnppjfjttlffhjjjsccbggnffqgfgjjnccmdmzmllvnlnznttlvlttvnvgnvvqvmvqqzrqqcgglzzwtztwwmjmzjjnddsffqrqlrrvsvdvldvvlgvlvccdzczcqcpphggtnthhhtbhtttcjtjcjgcjcbbrhbbfrffgjgdgzddcttczzsccbpcpddcpcggmjgjddtcccthccfrccmdmhmddnwddfldffntnptnpttcptcptpfphhmfmwfwmmlblgbgvbvlltqltldttfcfcclgcllmplmlbbjnjzjnzzttnvvgddshddsqddggsqgqddsggdhghjgjhhgchhdmdjmjddgdhghrrphrrpnnqhhjwwqrrcmmslmmszzpgzpzzrmzmznzllnjnnlnbbdvdsdffbpffcmmnznqqcbbzvvjnjvvwqwgqqpnnzwnzwnzwwwlpwpzzfqzfqqwnqnbnfnqnbqqbggqnqdndrrzzlffbbgqgfgrfrqqsddnqnqjjgssqwqwcqcpcrrqppwpjjfnfpffhphwwmcwwznw
const fs = require('fs');
const path = require('path');
const data = fs.readFileSync(path.join(__dirname, './input4.txt'), 'utf8');
const rules = fs.readFileSync(path.join(__dirname, './input4_1.txt'), 'utf8');
const config = rules.split(/\r?\n/).map(item => item.split(' ')).map(item => ({
from: Number(item[3]),
count: Number(item[1]),
to: Number(item[5])
}));
const fs = require('fs');
const path = require('path');
// 2-4,6-8
// 2-3,4-5
// 5-7,7-9
// 2-8,3-7
// 6-6,4-6
// 2-6,4-8
const fs = require('fs');
const path = require('path');
// RCMRQjLLWGTjnlnZwwnZJRZH
// qnvfhpSbvSppNddNdSqbbmmdPrwttJVrVPDVrJtHtwPZhrPJ
// BFpFzSSqSFFSvQsnWgCMjTLzng
// DbWVcVRRdlLffvtqjTWNgQ
// mJJMpsmrMrJSHJpsHrFHvBvgHvqfNvzffgTvfj
// mMhPjmjmFPJhMSGGcDRlwRdcLGPc
@BiosBoy
BiosBoy / testing.yml
Last active November 8, 2022 15:56
Testing CI workflow based on GitHub Actions. For JavaScript/React projects
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Unit + UI Testing
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]