Skip to content

Instantly share code, notes, and snippets.

View borislavstoychev's full-sized avatar
💭
💻 Coding....

Borislav Stoychev borislavstoychev

💭
💻 Coding....
View GitHub Profile
function calculator() {
let num1;
let num2;
let result;
return {
init: (selectorNum1, selectorNum2, selectorResult) =>{
num1 = document.getElementById(selectorNum1);
num2 = document.getElementById(selectorNum2);
result = document.getElementById(selectorResult);
},
function solve(input) {
let list = [];
const listCreator = (cmd, el) => {
let result = {
add: () => list.push(el),
remove: () => list = list.filter((x) => x !== el),
print: () => console.log(list.join(',')),
}
result[cmd]()
function game(arr){
let first = 'X';
let second = 'O';
const matrix = [
[false, false, false],
[false, false, false],
[false, false, false]
];
const diagonals = (matrix) => matrix.reduce((a, v, i) => a + v[i], '');
const col = (matrix, i) => matrix[i].reduce((a, b, j) => a + matrix[j][i], '');
function arenaTier(arr) {
let arena = {};
function sortByName(a, b) {
return a.localeCompare(b);
}
function sortBySum(objA, objB) {
let sumB = Object.entries(objB).reduce((a,v) => a += v[1], 0);
let sumA = Object.entries(objA).reduce((a,v) => a += v[1], 0);
function partyTime(arr) {
let map = new Map();
let [guestList, party] = arr.split("PARTY")
while (arr.length) {
let element = arr.shift();
if (!map.has(element)) {
if (element === "PARTY") {
break;
}
Part Type Pieces Part Name Part price, lv Part Link
HDD 6 SEAGATE Exos X16 512E/4KN 16TB ST16000NM001G чакам доставка Link
M.2 SSD for plotting 1 Samsung 980 PRO чакам доставка Link
M.2 SSD for OS 1 Samsung 970 EVO Plus 135 Link
Motherboard 1 MSI MAG B550 TOMAHAWK 352 Link
CPU 1 AMD RYZEN 7 3700X 8-Core 3.6 GHz 596 [Link](https://pcmall.bg/%d0%bf%d1%80%d0%be%d1%86%d0%b5%d1%81%d0%be%d1%80-amd-ryzen-7-3700x-8-core-3.6-ghz-4.4-ghz-turbo-36mb-65w-am4-box-amd-am4-r7-ryzen-3
function catalogues(arr) {
let catalogue = new Map();
arr.forEach(element => {
[keys, values] = element.split(" : ");
catalogue.set(keys, values)
});
let sorted = Array.from(catalogue.entries())
.sort(([keyA, valueA], [keyB, valueB]) => keyA.localeCompare(keyB));
let result = {};
sorted.forEach(element => {
function bombNums(arr1, arr2) {
let [bomb, power] = arr2
for (let i = 0; i < arr1.length; i++) {
if (arr1[i] === bomb) {
arr1.splice(i - power > 0 ? i - power : 0, power * 2 + 1);
i = 0;
}
}
return arr1.reduce((a, v) => a + v, 0);
function gladiatorInventory(arr) {
let inventory = arr.shift().split(" ");
const actions = {
Buy: (equipment) => buy(equipment),
Trash: (equipment) => trash(equipment),
Repair: (equipment) => repair(equipment),
Upgrade: (param) => upgrade(param)
};
function buy(eq) {
# Use antigen
source $HOME/antigen.zsh
# Load the oh-my-zsh's library.
antigen use oh-my-zsh
# Bundles from the default repo (robbyrussell's oh-my-zsh).
antigen bundle git
antigen bundle heroku
antigen bundle pip