Skip to content

Instantly share code, notes, and snippets.

View mirmostafa's full-sized avatar
🧗‍♂️
Coding is my lifestyle. But I live in Iran 😢

Mohammad Mirmostafa mirmostafa

🧗‍♂️
Coding is my lifestyle. But I live in Iran 😢
View GitHub Profile
@hamburger1984
hamburger1984 / MinimalAPIs.md
Created November 13, 2021 16:33 — forked from davidfowl/MinimalAPIs.md
Minimal APIs at a glance
@davidfowl
davidfowl / .NET6Migration.md
Last active June 16, 2024 05:29
.NET 6 ASP.NET Core Migration
@DanielSWolf
DanielSWolf / Program.cs
Last active June 13, 2024 17:26
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);
@vkhorikov
vkhorikov / CustomerController.cs
Last active May 25, 2024 19:53
Handling failures and input errors in a functional way
[HttpPost]
public HttpResponseMessage CreateCustomer(string name, string billingInfo)
{
Result<BillingInfo> billingInfoResult = BillingInfo.Create(billingInfo);
Result<CustomerName> customerNameResult = CustomerName.Create(name);
return Result.Combine(billingInfoResult, customerNameResult)
.OnSuccess(() => _paymentGateway.ChargeCommission(billingInfoResult.Value))
.OnSuccess(() => new Customer(customerNameResult.Value))
.OnSuccess(
@stephenhardy
stephenhardy / git-clearHistory
Created April 26, 2013 22:14
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git