Skip to content

Instantly share code, notes, and snippets.

@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;
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active June 2, 2025 03:37
Hyperlinks in Terminal Emulators
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)
{
@patik
patik / styles.css
Last active February 14, 2025 06:54 — forked from joshbode/numbered_headings.md
Numbered Headings in Markdown via CSS
body { counter-reset: h1counter h2counter h3counter h4counter h5counter h6counter; }
h1 { counter-reset: h2counter; }
h2 { counter-reset: h3counter; }
h3 { counter-reset: h4counter; }
h4 { counter-reset: h5counter; }
h5 { counter-reset: h6counter; }
h6 {}
h2:before {
@FeodorFitsner
FeodorFitsner / deploy.ps1
Created September 27, 2016 06:04
Parallel copying over FTP with WinSCP
param (
$sessionUrl = "ftp-host-name",
$username = "your-username",
$password = "your-password",
$remotePath = "/",
$localPath = "C:\projects\...",
$batches = 20
)
@davidfowl
davidfowl / Example1.cs
Last active September 2, 2024 12:36
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)
@CMCDragonkai
CMCDragonkai / bash_scoping.md
Last active February 8, 2025 17:37
Bash: The Scoping Rules of Bash

The Scoping Rules of Bash

There are 5 types of scopes in Bash:

  • Environment Scope - export x=1; echo "$x"; command
  • Shell Scope - x=1; echo "$x"
  • Function Scope - f () { local x=1; echo "$x"; }; f
  • Command Scope - x=1 command
  • Subshell Scope - x=1; (echo "$x"; y=2); echo $y
@parmentf
parmentf / GitCommitEmoji.md
Last active May 31, 2025 09:26
Git Commit message Emoji
@dvdsgl
dvdsgl / Monads for a C# dev.md
Last active October 10, 2024 20:26
Monads explained (sort of) to a C# developer

A monad is a fancy word for a generic type of the form MyMonad<T> (a generic type of arity 1).

A monad is special because it adds 'special powers' to the T that it wraps. These 'special powers' won't sound very special to an imperative programmer, so you have to squint to see them but bear with me.

  • IEnumerable<T> is a monad that gives values of type T the special power of nondeterminism, or the ability to 'be' multiple values at once.
  • Nullable<T> is a monad that gives values of type T the special power of nullability, or the ability to be absent.
  • Task<T> is a monad that gives values of type T the special power of asynchronicity, or the ability to be used before they are computed.

The trick with monads comes when you want to play with the T values, because they are inside another type. C# introduced language changes to make dealing with values inside these monads easier:

@PurpleBooth
PurpleBooth / README-Template.md
Last active May 27, 2025 20:56
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites