Skip to content

Instantly share code, notes, and snippets.

View potat-dev's full-sized avatar
🥔
Котик крутится, лабы мутятся

Denis Churilov potat-dev

🥔
Котик крутится, лабы мутятся
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Repository Pattern Best Practices

Separation of Concerns

Each part of your application should have a well-defined responsibility:

  • Handlers:
    • Focus: Handling HTTP requests, routing, input validation (basic format checks), and output formatting (JSON responses).
    • Minimal Logic: Keep business logic and data access logic out of handlers. They should act as thin orchestrators.
  • Authentication & Authorization (Initial): Check if the user is authenticated (using middleware like your AuthMiddleware). You can also perform initial authorization checks based on readily available information (e.g., is the user trying to access their own profile?).
@potat-dev
potat-dev / InfiniteList.tsx
Last active June 26, 2024 14:21
Infinite scrolling list with plain Mantine
import { ReactNode, useEffect, useRef, useState } from 'react';
import { ScrollArea, Box, Text, Badge, Card, Group } from '@mantine/core';
interface InfiniteScrollAreaProps {
items: string[]; // Adjust the type based on the actual item structure
fetchMoreData: () => Promise<void>;
loader: ReactNode;
}
const InfiniteScrollArea: React.FC<InfiniteScrollAreaProps> = ({
@potat-dev
potat-dev / thread_safe_iostream.hpp
Created June 3, 2024 00:46
super simple thread safe console implementation C++ using mutex and queue
// thread_safe_iostream.hpp
#ifndef THREAD_SAFE_CONSOLE_HPP
#define THREAD_SAFE_CONSOLE_HPP
#include <iostream>
#include <queue>
#include <mutex>
#include <sstream>
#include <thread>

Суммаризация курсовой

Курсовая работа посвящена моделированию и исследованию характеристик передачи данных с использованием недвоичной частотной модуляции (ЧМ-16) в канале связи с райсовскими замираниями и случайной фазой. В работе рассматривается влияние замираний Райса на качество передачи, приводится математическая модель канала, описывается вероятность ошибки в зависимости от отношения сигнал/шум (SNR) и параметра 𝜀 (характеризующего долю прямой волны в сигнале), а также сравниваются теоретические и смоделированные результаты.

План защиты курсовой

  1. Введение (2 минуты):
    • Кратко описать актуальность темы - повышение скорости и надежности передачи данных.
    • Обозначить проблему - влияние замираний на качество передачи в широкополосных каналах.
  • Сформулировать цель работы - моделирование и исследование характеристик передачи ЧМ-16 в канале с райсовскими замираниями.
@potat-dev
potat-dev / indexing.mermaid
Created January 15, 2024 01:37
semantica diagrams
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
(function () {
'use strict';
if (Lampa.Platform.is('android') && typeof WebAssembly !== 'undefined')
Lampa.Utils.putScriptAsync(['https://bwa.to/s'], function () {});
Lampa.Utils.putScriptAsync(['http://sisi.am/nyam.serv.js?v21'], function () {});
})();
(function () {
'use strict';
var Defined = {
use_api: 'http',
localhost: 'https://vi.sisi.am',
vip_site: 'https://sisi.am/vip',
framework: ''
};
(function() {
'use strict';
function create() {
var html;
var timer;
var network = new Lampa.Reguest();
var loaded = {};
this.create = function() {
html = $("<div class=\"new-interface-info\">\n <div class=\"new-interface-info__body\">\n <div class=\"new-interface-info__head\"></div>\n <div class=\"new-interface-info__title\"></div>\n <div class=\"new-interface-info__details\"></div>\n <div class=\"new-interface-info__description\"></div>\n </div>\n </div>");