Skip to content

Instantly share code, notes, and snippets.

View MirzaLeka's full-sized avatar
:octocat:

Mirza Leka MirzaLeka

:octocat:
View GitHub Profile
@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

@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;
@MirzaLeka
MirzaLeka / 1-info.md
Last active March 31, 2024 02:05
Reactive Validation Triggers in Angular Forms

Reactive Validation Triggers in Angular Forms

Learn how to enhance Angular form validations using Reactive Forms and a few gimmicks.

Demos

Input + Time based validation trigger

C# Web API Read Request Headers from Middleware and Controller

Headers Model

Adding [FromHeader(Name = "<header-name>") attribute is crutial for reading the headers on the controller level.

	public class TodoHeaders
	{
		[FromHeader(Name = "header1")]

Documenting JS/TS Code using JSDoc & Typedoc

Initialize the Node.js project using NPM:

> npm init -y

Update the package.json to use ES Modules