Skip to content

Instantly share code, notes, and snippets.

View fatuk's full-sized avatar

Andrei Fatiuk fatuk

View GitHub Profile
@fatuk
fatuk / ProtectedRoute.tsx
Created February 26, 2025 19:36
Wrapper for protected routes
import { Loader } from "@chakra-ui/react";
import { ReactNode, useEffect } from "react";
import { useNavigate } from "react-router-dom";
type Props = {
children?: ReactNode;
};
export const ProtectedRoute = ({ children }: Props) => {
const navigate = useNavigate();
.input {
display: flex;
flex-direction: column;
justify-content: center;
padding: 20px;
border-top: solid 1px;
border-bottom: solid 1px;
height: 75px;
box-sizing: border-box;
}
@fatuk
fatuk / interfacesVsTypes.ts
Created December 24, 2024 17:37
Пример интерфейсов и типов
type Doc = {
_id: string;
}
type User = Doc & {
name: string;
age: number;
}
const user1: User = {
@fatuk
fatuk / tsconfig.json
Created December 19, 2024 20:04
server ts config
{
"ts-node": {
"transpileOnly": false,
"require": ["tsconfig-paths/register"],
"files": true,
"compilerOptions": {}
},
"compilerOptions": {
"baseUrl": ".",
@fatuk
fatuk / package.json
Created December 19, 2024 20:02
ts-server package.json
{
"name": "next-episode-server",
"version": "1.0.0",
"description": "",
"main": "server.ts",
"scripts": {
"start": "nodemon --legacy-watch --exec ts-node -r tsconfig-paths/register ./src/server.ts",
"build": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json",
"serve": "node -r tsconfig-paths/register dist/server.js"
},
@fatuk
fatuk / server.js
Created December 17, 2024 19:50
Victor REST API server
require('dotenv').config();
const express = require('express');
const app = express();
const { MongoClient } = require('mongodb');
const { ObjectId } = require('mongodb');
const port = process.env.PORT || 3000;
const mongoUri = process.env.MONGO_URI || 'mongodb+srv://new-user386:[email protected]/?retryWrites=true&w=majority&appName=Cluster0';
const client = new MongoClient(mongoUri);
const cors = require('cors');
@fatuk
fatuk / find_colors.sh
Created May 10, 2024 11:31
./find_colors.sh [folder_to_search]
#!/usr/bin/bash
# Файл для хранения найденных цветов
output_file="colors.txt"
# Очистим файл, если он уже существует
echo "" > $output_file
# Функция для поиска hex-цветов
find_hex_colors() {
@fatuk
fatuk / floating-moment.rb
Created August 30, 2023 11:30 — forked from sven-wachsmuth/floating-moment.rb
Sonic Pi - Soundscape for relaxing
# floating-moment.rb
# ambient soundscape for relaxing and meditation
# Created by Sven Wachsmuth
# https://gist.github.com/sven-wachsmuth/0cc06cc0d698d8932ceb142dcf5231ba
use_bpm 60
laenge_in_takten = 229 # length of the track in beats - 300 means relax 5 minutes :-)
# possible notes out of a sounds-well-scale
@fatuk
fatuk / dnb.rb
Created August 30, 2023 11:29 — forked from findscode/dnb.rb
My Drum&Bass template
samps = "C:/Program Files (x86)/Sonic Pi/etc/my-samples"
use_bpm 170
live_loop :metro do
sleep 1
cue :beat
sleep 7
cue :ambient
end
@fatuk
fatuk / ambient1
Created August 30, 2023 11:07 — forked from darinwilson/ambient1
Ambient experiment using Sonic Pi
# Ambient experiment for Sonic Pi (http://sonic-pi.net/)
#
# The piece consists of three long loops, each of which plays one of
# two randomly selected pitches. Each note has different attack,
# release and sleep values, so that they move in and out of phase
# with each other. This can play for quite awhile without
# repeating itself :)
live_loop :note1 do
use_synth :hollow