Skip to content

Instantly share code, notes, and snippets.

View MirzaLeka's full-sized avatar
:octocat:

Mirza Leka MirzaLeka

:octocat:
View GitHub Profile
using APIDocsRider.DB;
using Microsoft.Data.SqlClient;
using Microsoft.EntityFrameworkCore;
namespace APIDocsRider.BL;
public class WorkerService(ILogger<WorkerService> logger, IServiceProvider serviceProvider) : BackgroundService
{
private readonly IServiceProvider _serviceProvider = serviceProvider;
private readonly ILogger<WorkerService> _logger = logger;
@MirzaLeka
MirzaLeka / IOrderService.cs
Last active July 17, 2025 15:01
ASP .NET Worker Service for Apache ActiveMQ
namespace AMQSubscriberWorker.Services
{
public interface IOrderService
{
PizzaOrder? DeserializeOrder(string pizzaOrder);
}
}
@MirzaLeka
MirzaLeka / app-structure.md
Last active April 27, 2025 13:05
HTML & JS Push Notifications

Project Info

This example demonstrates how to handle browser push notifications using vanilla HTML & JavaScript via Web Push API. WebPush API sends messages from the server (backend) to the client (browser/mobile phone). The API uses HTTP2 protocol which requires HTTPS connection (unless you're in localhost) The server sends messages to the client's browser via Firebase Cloud Messaging API (or FCM for short).

Prerequisites

  • You need to obtain the public VAPID key to be able to connect to the server. Look up generate-VAPID-key.md file.
  • Make sure Backend server uses the same VAPID keys.
@MirzaLeka
MirzaLeka / main.md
Last active April 23, 2025 19:39
.NET to Node.js Rabbit MQ Example

.NET to Node.js via Rabbit MQ

  • Sender: .NET 8
  • Receiver: Node.js
  • Protocol: AMQPS (secured AMQP)
  • RabbitMQ Host:: AWS (AMQ)

Package Versions

.NET

To log into SQL Server using Serilog and store logs in your custom logs table, follow these steps:


1. Install Required Packages

Ensure you have the necessary Serilog packages installed via NuGet:

Install-Package Serilog
Install-Package Serilog.Sinks.MSSqlServer
@MirzaLeka
MirzaLeka / 0-init.md
Created October 11, 2024 13:52
Angular Reactive Form with Async Validations

Angular Reactive Forms with Validations & Async Validations

@MirzaLeka
MirzaLeka / dayjs-sort.md
Created September 29, 2024 10:46
Dayjs sort by Date

DayJS Sort By Date

var dayjs = require("dayjs")

let n = [ '2018-10-05T10:30:00',
  '2018-10-05T08:05:00',
  '2018-10-05T08:20:00',
  '2018-10-05T08:30:00',
 '2018-10-05T10:10:00',
@MirzaLeka
MirzaLeka / migrate-to-angular-18.md
Created September 14, 2024 18:41
Angular 18 Upgrade Guide

Angular 18 Upgrade Guide

Version before the update:

  • Angular: 17.3
  • Node.js: 18.8

Install Node.js LTS

  • Download Node.js 20.17.0
  • Install on the machine
@MirzaLeka
MirzaLeka / read-object-metadata-in-csharp.md
Last active July 23, 2024 16:27
Object.keys & Object.values in C#

C# - Read Object MetaData using Reflections

C# is statically typed language which requires explicit handling for runtime inspection.

Reflection is what allows C# developers to inspect data structures by looking up:

  • The type of an object
  • Properties
  • Methods, etc.
@MirzaLeka
MirzaLeka / 1-json-to-csharp.md
Last active July 28, 2024 08:03
Read JSON file into a C# Classes

Read JSON file into a C# Classes

Create the class skeleton

using Newtonsoft.Json; // Requires installation

public class LINQTutorial
{
    private List<Student> _students;