Skip to content

Instantly share code, notes, and snippets.

View goldytech's full-sized avatar

Muhammad Afzal Qureshi goldytech

View GitHub Profile
@goldytech
goldytech / adr.md
Last active June 5, 2024 11:43
ADR Template

Architecture Decision Record (ADR)

Title

Use PostgreSQL as the primary database

Status

Accepted

Context

We need a reliable and scalable database solution for our web application. Currently, we are using a lightweight SQLite database, which is not suitable for production due to its limitations in concurrency and scalability.

@goldytech
goldytech / FileIOTest.cs
Created May 31, 2021 12:51
Calling file processor
var pool = ArrayPool<Employee>.Shared;
var employeeRecords = pool.Rent(100000);
var pipeLinesTest = new WithPipeLines();
try
{
await pipeLinesTest.ProcessFileAsync(_filePath, employeeRecords);
}
finally
{
@goldytech
goldytech / WithPipeLines.cs
Created May 31, 2021 12:46
System.IO.Pipelines csv file processing
#nullable enable
using System;
using System.Buffers;
using System.IO;
using System.IO.Pipelines;
using System.Text;
using System.Threading.Tasks;
namespace FileIO
{
using System;
using System.Linq;
using System.Threading.Tasks;
using Marvin.Cache.Headers;
using Marvin.Cache.Headers.Interfaces;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Options;
namespace Peddle.ApiGateway.MiddlewareComponents
{
"use strict";
const { ServiceBroker } = require("moleculer");
const { ValidationError } = require("moleculer").Errors;
const TestService = require("../../../services/greeter.service");
describe("Test 'greeter' service", () => {
let broker = new ServiceBroker({ logger: false });
broker.createService(TestService);
"use strict";
const db = require("../database");
/**
* @typedef {import('moleculer').Context} Context Moleculer's Context
*/
module.exports = {
"use strict";
const db = require("../database");
const jwt = require("jsonwebtoken");
const { MoleculerClientError } = require("moleculer").Errors;
const User = db.User;
const {isEmptyObject, compareHash,APP_EVENTS } = require("../util");
const { Op } = require("sequelize");
/**
@goldytech
goldytech / clm.cs
Created October 7, 2019 12:33
Agreement Life Cycle
public enum StatusCategory
{
Request,
InSignature,
InAuthoring,
InEffect,
Terminated,
Expired
}
@goldytech
goldytech / HrManagerByPropertyPattern.cs
Created October 7, 2019 12:13
Property Pattern matching
private static bool IsHrManagerByPropertyPattern(object employee)
{
return employee is Emp e && e is { IsManager: true, Department: {Name: "Human Resources" } };
}
@goldytech
goldytech / empobj.cs
Created October 7, 2019 11:27
Employee object
var employee = new Employee
{
Id = 1,
Department = new Department {Id = 1, Name = "Human Resources"},
Name = "John Doe",
IsManager = true
},