Skip to content

Instantly share code, notes, and snippets.

View AmirMahdyJebreily's full-sized avatar
🙅
busy programmer ...

Code Agha AmirMahdyJebreily

🙅
busy programmer ...
View GitHub Profile
@AmirMahdyJebreily
AmirMahdyJebreily / deep-copy.cs
Created December 24, 2023 11:28
Deep copy, for copying a folder and all its contents
double _progressCopy;
double _progressAll;
string primeFolderPath = Console.ReadLine(),
destFolderPath = Console.ReadLine();
try
@AmirMahdyJebreily
AmirMahdyJebreily / euclidean-gcd.cs
Last active December 17, 2023 19:34
Euclidean algorithm for GCD in C# By CodeAgha
/*
Euclidean algorithm for GCD in C# By CodeAgha
The parenthesis is the GCD (Greatest common factor) sign and the 'mod' symbol is equal to the remainder of the division.
In any case, we write the smaller number first and the larger number second
Proof from division theorem
a/b => a = bq + r
v != 0 | gcd(u, v) = gcd(v, u mod v)
// Receiving database files from clients via http request
[ParameterRoute(HttpMethod.PUT, "/server/uploadFile/{fileName}")]
public static async Task GetFile(HttpContext ctx)
{
try
{
// Url data
string fileName = ctx.Request.Url.Parameters["fileName"];
// Variabels
@AmirMahdyJebreily
AmirMahdyJebreily / contacts_oop.py
Last active August 11, 2023 11:19
oop course : create an oop contacts app with python
import re
phonenumberValidateRegEx = r"((0?9)|(\+?989))((14)|(13)|(12)|(19)|(18)|(17)|(15)|(16)|(11)|(10)|(90)|(91)|(92)|(93)|(94)|(95)|(96)|(32)|(30)|(33)|(35)|(36)|(37)|(38)|(39)|(00)|(01)|(02)|(03)|(04)|(05)|(41)|(20)|(21)|(22)|(23)|(31)|(34)|(9910)|(9911)|(9913)|(9914)|(9999)|(999)|(990)|(9810)|(9811)|(9812)|(9813)|(9814)|(9815)|(9816)|(9817)|(998))\W?\d{3}\W?\d{4}"
# use this RegEx for encapsulate email field in contacts class
emailValidateRegEx = r"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$"
# OOP (Object oriented Programming) => Class : Polymorphysm : Inheritance : Encapsulation
# S.O.L.I.D
@AmirMahdyJebreily
AmirMahdyJebreily / apcb-fcc-202357-contacts.py
Created July 25, 2023 14:34
Advanced Python course of besat school - first code chalange
# CodeAgha 2023 - Advanced Python course of besat school - first code chalange
import re # import regex module
# regex for phone number validation
regex = r"((0?9)|(\+?989))((14)|(13)|(12)|(19)|(18)|(17)|(15)|(16)|(11)|(10)|(90)|(91)|(92)|(93)|(94)|(95)|(96)|(32)|(30)|(33)|(35)|(36)|(37)|(38)|(39)|(00)|(01)|(02)|(03)|(04)|(05)|(41)|(20)|(21)|(22)|(23)|(31)|(34)|(9910)|(9911)|(9913)|(9914)|(9999)|(999)|(990)|(9810)|(9811)|(9812)|(9813)|(9814)|(9815)|(9816)|(9817)|(998))\W?\d{3}\W?\d{4}"
contacts = {
"Ali": "+989123458965",
"Sara": "+989121068969",
@AmirMahdyJebreily
AmirMahdyJebreily / gdc.cs
Created July 4, 2023 10:04
Compute GDC in C#
int num1 = int.Parse(Console.ReadLine());
int num2 = int.Parse(Console.ReadLine());
Console.WriteLine(GCD(num1, num2));
int GCD(int num1, int num2)
{
int res = 0;
@AmirMahdyJebreily
AmirMahdyJebreily / Avg.cs
Created June 21, 2023 18:18
Get averrage with c#
// Code Agha => https://github.com/AmirMahdyJebreily
Console.Write("Enter dads count here : ");
Console.ForegroundColor = ConsoleColor.Cyan;
int count = int.Parse(Console.ReadLine());
int[] dads = new int[count];
Console.ResetColor();
Console.WriteLine();
for (int i = 0; i < count; i++)
{
@AmirMahdyJebreily
AmirMahdyJebreily / conventional_commit_messages.md
Last active April 26, 2024 08:48 — forked from qoomon/conventional_commit_messages.md
کامیت های مرسوم گیت | Conventional Commit Messages

کامیت های مرسوم گیت | Conventional Commit Messages

ترجمه شده از اینجا با زبان خودمونی تر که هر آدمی بفهمه (هم منی که چند ساله کار میکنم هم اونی که تازه شروع کرده)

چرا باید خوب کامیت بزنیم ؟

این که شما بخواهید در یک پروژه متن باز مشارکت داشته باشید یا اینکه یک پروژه رو با دوستانتون پیش ببرید، نیازمند یک فرمت یا قانون مشخص برای کامیت زدنه! زمانی این نیاز احساس میشه که کامیت های پروژه زیاد شدن و شما نمیدونید دقیقا توی کدوم کامیت چیکار کردید. درست کامیت زدن باعث میشه تا بتونید راحت تر تغییرات رو مدیریت و در انتها یک ریپوزیتوری خوب بسازید که همه بتونن بفهمن شما دقیقا چیکار کردید و بتونن بهتر کمک کنند !
ببین چطوری میتونی با تغییر دادن مدل کامیت زدنت، بین خودت و بقیه تفاوت ایجاد کنی. نمونه ها به شخصه استفاده از این قرارداد یا انواع دیگه ای از اینجور قرارداد ها برای کامیت زدن رو پیشنهاد میکنم. چرا که نه تنها به درد کار های شخصی و تیمی کوچیک میخوره، بلکه به درد کار های بزرگ و سازمانی هم میخورن! باعث میشه از یه جایی ب