Skip to content

Instantly share code, notes, and snippets.

View shahabganji's full-sized avatar
:octocat:
Coding ...

Shahab - Saeed Ganji shahabganji

:octocat:
Coding ...
View GitHub Profile
@vkhorikov
vkhorikov / CustomerController.cs
Last active May 4, 2024 01:25
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(
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@alexandrevicenzi
alexandrevicenzi / HttpClientExtensions.cs
Created February 25, 2014 20:11
C# Post, Put and Patch as JSON async extensions
using System;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Threading.Tasks;
namespace MyProject.Extensions
{
public static class HttpClientEx
{
public const string MimeJson = "application/json";
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"