Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
public static class TaskTupleExtensions
{
#region (Task<T1>)
public static TaskAwaiter<T1> GetAwaiter<T1>(this ValueTuple<Task<T1>> tasks)
{
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active June 15, 2024 01:44
Hyperlinks in Terminal Emulators
@louthy
louthy / CSharp Free Monad.cs
Last active April 2, 2022 16:20
C# Free Monad
//
// See https://github.com/louthy/language-ext
//
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using LanguageExt;
using static LanguageExt.Prelude;
@rueycheng
rueycheng / GNU-Make.md
Last active June 12, 2024 07:18
GNU Make cheatsheet
@maartenba
maartenba / Transform-Xslt.ps1
Created September 22, 2017 08:43
ReSharper command line tools XSLT
param ($xml, $xsl, $output)
if (-not $xml -or -not $xsl -or -not $output)
{
Write-Host "& .\Transform-Xslt.ps1 [-xml] xml-input [-xsl] xsl-input [-output] transform-output"
exit;
}
trap [Exception]
{
@FransBouma
FransBouma / StringBuilderCache.cs
Created December 4, 2017 15:00
Adjusted StringBuilderCache, which caches 4 string builders at once
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
/*============================================================
**
** Class: StringBuilderCache
**
** Purpose: provide a cached reusable instance of stringbuilder
@dadhi
dadhi / FreeIOMonad.cs
Last active October 9, 2022 03:05
Example of Free IO monad in pure C# with separated re-usable monad implementation
/*
Modified from the original https://gist.github.com/louthy/524fbe8965d3a2aae1b576cdd8e971e4
- removed dependency on [language-ext](https://github.com/louthy/language-ext)
- separated monadic boilerplate, so you may concentrate on describing the operations and interpretation of the program
- removed `IO<A>.Faulted` to simplify the examples. It can be added back in straightforward manner.
Useful links:
- [John DeGoes: Beyond Free Monads - λC Winter Retreat 2017](https://www.youtube.com/watch?v=A-lmrvsUi2Y)
- [Free and tagless compared - how not to commit to a monad too early](https://softwaremill.com/free-tagless-compared-how-not-to-commit-to-monad-too-early)
@noelbundick
noelbundick / LICENSE
Last active May 24, 2024 09:10
Exclude WSL installations from Windows Defender realtime protection
MIT License
Copyright (c) 2018 Noel Bundick
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@dadhi
dadhi / Lens.cs
Last active February 23, 2024 09:41
Functional optics, e.g. Lens, in C# - to simplify access and modification for deep part of immutable value
/*
Inspired by: https://medium.com/@gcanti/introduction-to-optics-lenses-and-prisms-3230e73bfcfe
*/
using System;
using static System.Console;
public static class Program
{
public static void Main()
@dadhi
dadhi / index.md
Last active March 11, 2019 11:03
Discriminated Union or ADT Sum-type in C#