Skip to content

Instantly share code, notes, and snippets.

View davidcsejtei's full-sized avatar

Dávid Csejtei davidcsejtei

  • CEO & Co-Founder of Amicode Expert Kft.
  • Hungary
View GitHub Profile
@davidcsejtei
davidcsejtei / socket-room.service.ts
Created August 1, 2025 11:26
Custom socket room handling in Nest.js
import { Injectable } from '@nestjs/common';
import { PinoLogger } from 'nestjs-pino';
import { Server, Socket } from 'socket.io';
import { RoomType } from '../../types/socket-room.types';
@Injectable()
export class SocketRoomService {
private socketServer: Server;
constructor(private readonly logger: PinoLogger) {}
@davidcsejtei
davidcsejtei / gist:a86174f6debacc94eb3016c878e0c75d
Created August 1, 2025 11:13
One of my previous JIRA task as a technical writing
ABCD-5432 JIRA ticket:
Improve the API with a /devices endpoint. The endpoint's functionality comes from the attached Product Specification Documentation.
Definition of Done:
- The /devices endpoint returns the devices array following the sample data structure contained in the related documentation.
- If the company doesn't have any devices at the selected address → /devices returns an empty array.
How to demo (with the UI parts):
@davidcsejtei
davidcsejtei / docker-compose.yml
Last active June 11, 2025 19:58
Kafka docker compose
services:
zookeeper:
image: confluentinc/cp-zookeeper:7.6.0
ports:
- '2181:2181'
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
kafka:
@davidcsejtei
davidcsejtei / builder.sh
Last active June 6, 2025 07:31
CommonJS - product code generation
npx esbuild main.js --bundle --outfile=bundle.js
vs
npx esbuild app.js --bundle --format=esm --outfile=bundle.js
@davidcsejtei
davidcsejtei / docker-compose.yml
Created June 4, 2025 08:27
Kafka + Zookeeper docker compose
version: '3'
services:
zookeeper:
image: confluentinc/cp-zookeeper:7.5.0
environment:
ZOOKEEPER_CLIENT_PORT: 2181
kafka:
image: confluentinc/cp-kafka:7.5.0
depends_on:
@davidcsejtei
davidcsejtei / docker-compose.yml
Created June 4, 2025 07:27
MongoDB + MongoExpress docker compose
version: '3.8'
services:
mongo:
image: mongo:7
container_name: mongodb
restart: always
ports:
- '27017:27017'
volumes:
@davidcsejtei
davidcsejtei / docker-compose.yml
Created May 29, 2025 23:08
Redis and Redis Insight
version: '3.8'
services:
redis:
image: redis:7-alpine
container_name: redis-local
ports:
- '6379:6379'
networks:
- redis-net
class LRUCache {
constructor(capacity) {
this.capacity = capacity
this.cache = new Map()
}
get(key) {
if (this.cache.has(key)) {
// If the key exists in the cache, move it to the front
const value = this.cache.get(key)
@davidcsejtei
davidcsejtei / angular-theory.md
Created October 4, 2023 14:19
Interview pack

1. What is Angular?

Angular is a platform and framework for building client-side applications with HTML, CSS, and JavaScript/TypeScript. It's particularly suited for building single-page applications (SPAs). Angular provides developers with tools and design patterns to build and scale complex applications. It's maintained by Google and a community of individuals and corporations.

2. What is TypeScript?

TypeScript is a superset of JavaScript developed by Microsoft. It introduces static types, classes, interfaces, and other Object-Oriented Programming (OOP) features to the language. When TypeScript code is compiled, it is translated into plain JavaScript code, making it compatible with any browser. TypeScript enhances the development experience by catching errors early through a robust type system.

3. What is the difference between constructor and ngOnInit?

@davidcsejtei
davidcsejtei / readme.md
Created September 15, 2023 07:21
Add ESLint and Prettier to an existing Angular project

GOAL

if you save a file in your project, the IDE should "autoformat" the file following a given ruleset (ESLint and Prettier configurations).

Example of adding semicolons on save:

Example using ESLint and Prettier

STEPS