This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const XLSX = require('xlsx'); | |
const data = { | |
key1: 'foo', | |
key2: { | |
bar: 'baz', | |
test: { | |
omg: true, | |
}, | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity ^0.8.7; | |
library Math { | |
function safeAdd(uint256 x, uint256 y) internal pure returns (uint256) { | |
uint256 z = x + y; | |
require(z >= x, "math-add-overflow"); | |
return z; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.7; | |
contract LiquidityHelper { | |
function sendValue(address payable recipient, uint256 amount) private { | |
require(address(this).balance >= amount, "Insufficient balance"); | |
(bool success, ) = recipient.call{value: amount}(""); | |
require(success, "Unable to send value"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pynput.mouse import Controller | |
from datetime import datetime | |
import time | |
import random | |
mouse = Controller() | |
TOTAL_MOVES = 100 | |
while True: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// nums = [11,2,7,15], target = 9, out = [1,2] | |
// дан массива nums и int targer, необходимо вернуть индексы двух любых элементов массива, которые в сумме равны target | |
function TwoSum(nums = [], target){ | |
const numsMap = new Map( | |
nums | |
.map((num, idx) => [target + num, idx]) | |
) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const str = 'AAACCXXXXAAAAAABBBBBK'; // A3C2X4A6B5K1 | |
const countLetters = (str) => { | |
if (str.length === 0) { | |
return ""; | |
} | |
let prevLetter = str[0]; | |
let letterCounter = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.root { | |
display: flex; | |
flex-direction: column; | |
justify-content: space-between; | |
box-sizing: border-box; | |
max-width: 650px; | |
min-height: 100vh; | |
margin: auto; | |
padding-top: 3rem; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface IParams { | |
multiple?: boolean; | |
readAsText?: boolean; | |
allowedExtensions?: string[]; | |
} | |
export class InvalidExtensionError extends Error {} | |
export const readFileText = (file: File) => new Promise<string>((res) => { | |
const reader = new FileReader(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { injectable, inject } from "inversify"; | |
import { action, computed, observable, transaction } from "mobx"; | |
import { makeObservable, toJS } from "mobx"; | |
import IPeer from "../../../model/IPeer"; | |
import ApiService from "../../base/ApiService"; | |
import ErrorService from "../../base/ErrorService"; | |
import SphereReadService from "../../base/SphereReadService"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
const applyCount = (line) => { | |
return line.reduce((acm, cur) => { | |
/** | |
* Получаем последнюю записанную букву | |
* со счетчиком | |
*/ | |
const lastItem = acm.pop(); | |
/** | |
* Если массив пустой, во избежание деструктуризации |