Skip to content

Instantly share code, notes, and snippets.

View tripolskypetr's full-sized avatar
💻
Frontend dev fueled by a passion for UI/UX and art, design

Petr Tripolsky tripolskypetr

💻
Frontend dev fueled by a passion for UI/UX and art, design
View GitHub Profile
@tripolskypetr
tripolskypetr / problem.js
Last active September 5, 2023 10:55
fibonacci sequence memoization
import { useCallback, useState } from "react";
import "./styles.css";
const fib = (numbersQuantity) => {
var fibonacciNumbers = [1, 1];
for (var i = fibonacciNumbers.length; numbersQuantity > i; i++) {
console.log("Iter");
fibonacciNumbers.push(fibonacciNumbers[i - 1] + fibonacciNumbers[i - 2]);
}
export interface IBidDto extends IBidReference {
zagolovok: string;
kategoriya_obekta: string | null;
prodazha: string[] | null;
arenda: string[] | null;
naznachenie_obekta: string;
raspolozhenie_obekta: string[] | null;
istochnik: string | null;
podkategoriya_obekta: string | null;
nazvanie_zhk: string;
@tripolskypetr
tripolskypetr / types.ts
Created August 12, 2023 09:25
types.ts
export interface IApartmentDto extends IApartmentReference {
zagolovok: string;
kategoriya_obekta: string[] | null;
prodazha: string[] | null;
arenda: string[] | null;
podkategoriya_obekta: string | null;
istochnik: string | null;
nazvanie_zhk: string;
vid_obekta: string | null;
@tripolskypetr
tripolskypetr / appwrite.json
Created August 10, 2023 13:50
appwrite.json
{
"projectId": "64b53d0c41fcf5093b12",
"projectName": "RealEstate",
"databases": [
{
"$id": "64c4de8e7b30179809ef",
"name": "DATABASE",
"$createdAt": "2023-07-29T09:40:30.505+00:00",
"$updatedAt": "2023-08-10T11:24:00.071+00:00"
}
window.ethereum.request({
method: "wallet_addEthereumChain",
params: [{
chainId: "0x89",
rpcUrls: ["https://polygon-rpc.com/"],
chainName: "Matic Mainnet",
nativeCurrency: {
name: "MATIC",
symbol: "MATIC",
@tripolskypetr
tripolskypetr / react-virtual-view.ts
Last active February 4, 2023 19:00
Virtualized view for React
import * as React from "react";
import { useCallback, useState, useEffect, useLayoutEffect, useRef, useMemo } from "react";
import { makeStyles } from "../../styles";
import Box, { BoxProps } from "@mui/material/Box";
import useActualCallback from "../../hooks/useActualCallback";
import useSingleton from "../../hooks/useSingleton";
import throttle from "../../utils/hof/throttle";
@tripolskypetr
tripolskypetr / sheetjs-serialize-record.js
Created January 10, 2023 19:40
SheetJS Record serializer
const XLSX = require('xlsx');
const data = {
key1: 'foo',
key2: {
bar: 'baz',
test: {
omg: true,
},
},
@tripolskypetr
tripolskypetr / CustomERC20.sol
Created January 7, 2023 20:17
Custom ERC20 token
// 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;
}
@tripolskypetr
tripolskypetr / example.sol
Created December 27, 2022 21:35
Solidity smart contract for interview preparation
// 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");
}
@tripolskypetr
tripolskypetr / mousejiggler.py
Created December 27, 2022 15:42
Mouse Jiggler compatible with OSX 10.14
from pynput.mouse import Controller
from datetime import datetime
import time
import random
mouse = Controller()
TOTAL_MOVES = 100
while True: