Skip to content

Instantly share code, notes, and snippets.

View wahidustoz's full-sized avatar
🏠
Working from home

Wahid Abduhakimov wahidustoz

🏠
Working from home
View GitHub Profile
@wahidustoz
wahidustoz / requirements.md
Last active July 5, 2025 03:13
Quiz Engine | C# Project

📚 Quiz engine

Build a two‑mode console app—Teacher and Student—that creates, manages, and runs quizzes, using Spectre.Console for all user interaction.

New in this version

  • Teacher Mode can disable / enable or delete existing quizzes.
  • Optional time‑limited questions feature worth +50 bonus points.

{"name":".NET (wahidustoz)","settings":"{\"settings\":\"{\\r\\n \\\"workbench.colorTheme\\\": \\\"Shades of Purple\\\",\\r\\n \\\"tabnine.experimentalAutoImports\\\": true,\\r\\n \\\"files.autoSave\\\": \\\"afterDelay\\\",\\r\\n \\\"workbench.productIconTheme\\\": \\\"material-product-icons\\\",\\r\\n \\\"workbench.iconTheme\\\": \\\"material-icon-theme\\\",\\r\\n \\\"editor.stickyScroll.enabled\\\": false,\\r\\n \\\"terminal.integrated.fontFamily\\\": \\\"CaskaydiaCove Nerd Font\\\",\\r\\n \\\"redhat.telemetry.enabled\\\": true,\\r\\n \\\"vs-kubernetes\\\": {\\r\\n \\\"vscode-kubernetes.helm-path-windows\\\": \\\"C:\\\\\\\\Users\\\\\\\\wahid\\\\\\\\.vs-kubernetes\\\\\\\\tools\\\\\\\\helm\\\\\\\\windows-amd64\\\\\\\\helm.exe\\\",\\r\\n \\\"vscode-kubernetes.minikube-path-windows\\\": \\\"C:\\\\\\\\Users\\\\\\\\wahid\\\\\\\\.vs-kubernetes\\\\\\\\tools\\\\\\\\minikube\\\\\\\\windows-amd64\\\\\\\\minikube.exe\\\",\\r\\n \\\"vs-kubernetes.kubeconfig\\\": {\\r\\n
@wahidustoz
wahidustoz / General.md
Last active June 29, 2025 05:01
Stackup | Challenges

1. Convert Age

Write a C# function that converts given age in years into days.

  • consider a year has 365 days
  • ignore leap years
Example
Input Output
65 23725
@wahidustoz
wahidustoz / DayOfWeekFlag.cs
Created March 9, 2025 01:02
Hafta kunlari o'zbekcha nomlari bilan
[Flags]
enum DayOfWeekFlag
{
None = 0,
Monday = 1,
Tuesday = 2,
Wednesday = 4,
Thursday = 8,
Friday = 16,
Saturday = 32,
@wahidustoz
wahidustoz / .NET (wahidustoz) Profile
Created October 20, 2024 10:25
.NET (wahidustoz) Profile
{"name":".NET (wahidustoz)","settings":"{\"settings\":\"{\\r\\n \\\"workbench.colorTheme\\\": \\\"Shades of Purple\\\",\\r\\n \\\"editor.fontSize\\\": 18,\\r\\n \\\"tabnine.experimentalAutoImports\\\": true,\\r\\n \\\"files.autoSave\\\": \\\"afterDelay\\\",\\r\\n \\\"workbench.productIconTheme\\\": \\\"material-product-icons\\\",\\r\\n \\\"workbench.iconTheme\\\": \\\"material-icon-theme\\\",\\r\\n \\\"editor.stickyScroll.enabled\\\": false,\\r\\n \\\"terminal.integrated.fontFamily\\\": \\\"CaskaydiaCove Nerd Font\\\",\\r\\n \\\"redhat.telemetry.enabled\\\": true,\\r\\n \\\"vs-kubernetes\\\": {\\r\\n \\\"vscode-kubernetes.helm-path-windows\\\": \\\"C:\\\\\\\\Users\\\\\\\\wahid\\\\\\\\.vs-kubernetes\\\\\\\\tools\\\\\\\\helm\\\\\\\\windows-amd64\\\\\\\\helm.exe\\\",\\r\\n \\\"vscode-kubernetes.minikube-path-windows\\\": \\\"C:\\\\\\\\Users\\\\\\\\wahid\\\\\\\\.vs-kubernetes\\\\\\\\tools\\\\\\\\minikube\\\\\\\\windows-amd64\\\\\\\\minikube.exe\\\"\\r\\n },\\r\\n
/// <summary>
/// If the service uses dbContext, make sure to get another dbContext within ForEachAsync using service provider
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="source"></param>
/// <param name="maxDegreeOfParallelism"></param>
/// <param name="body"></param>
/// <returns></returns>
public static Task ForEachAsync<T>(IEnumerable<T> source, int maxDegreeOfParallelism, Func<T, Task> body)
{
@wahidustoz
wahidustoz / IDistributedCache.GetOrCreateAsync.cs
Created April 15, 2024 18:33
IDistributedCache GetOrCreateAsync extension method.
public static class DistributedCacheExtensions
{
public static async Task<T?> GetOrCreateAsync<T>(
this IDistributedCache cache,
string key,
Func<DistributedCacheEntryOptions, Task<T>> factory,
CancellationToken cancellationToken = default)
{
var value = await cache.GetStringAsync(key, cancellationToken);
if(string.IsNullOrWhiteSpace(value))
@wahidustoz
wahidustoz / Heap.cs
Created November 23, 2023 05:12
Binary Heap C# implementation
public class Heap<T> where T : IComparable<T>
{
private class Node(T value)
{
public T Value { get; set; } = value;
private Node right = default;
public ref Node Right => ref right;
private Node left = default;
public ref Node Left => ref left;
@wahidustoz
wahidustoz / .net.editorconfig
Last active November 6, 2023 19:58
.NET editorconfig
root = true
# All files
[*]
indent_style = space
# Xml files
[*.xml]
indent_size = 2
@wahidustoz
wahidustoz / fluent-async-autovalidation.cs
Created December 9, 2022 05:44
Adds async auto validation to FluentValidation
using System;
using System.Threading.Tasks;
using FluentValidation;
using FluentValidation.AspNetCore;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace Actions
{
public class AsyncAutoValidation : IAsyncActionFilter