Skip to content

Instantly share code, notes, and snippets.

View MartinJohns's full-sized avatar

Martin Johns MartinJohns

View GitHub Profile
@ian-p-cooke
ian-p-cooke / add_wsl_exclusions.ps1
Last active November 12, 2022 05:02
powershell script to add WSL exclusions
$win_user = "ipc"
$linux_user = "ipc"
$package = "CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc"
$base_path = "C:\Users\" + $win_user + "\AppData\Local\Packages\" + $package + "\LocalState\rootfs"
$dirs = @("\bin", "\sbin", "\usr\bin", "\usr\sbin", "\home\" + $linux_user + "\.cargo\bin")
$dirs | ForEach { Add-MpPreference -ExclusionProcess ($base_path + $_ + "\*") }
Add-MpPreference -ExclusionPath $base_path
anonymous
anonymous / LoginController.cs
Created December 8, 2016 06:31
using AlpacaCore.SiteFramework.SimpleLogin.ViewModels;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http.Authentication;
using SiteFramework.Abstractions;
using SiteFramework.Abstractions.Repositories;
using System;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Collections.Generic;
@iamarcel
iamarcel / Creating Neat .NET Core Command Line Apps.md
Last active November 28, 2023 10:41
Creating Neat .NET Core Command Line Apps

Creating Neat .NET Core Command Line Apps

You can now read this on my (pretty) website! Check it out here.

Every reason to get more HackerPoints™ is a good one, so today we're going to write a neat command line app in .NET Core! The Common library has a really cool package Microsoft.Extensions.CommandlineUtils to help us parse command line arguments and structure our app, but sadly it's undocumented.

No more! In this guide, we'll explore the package and write a really neat

@mhoyer
mhoyer / AsyncDollsAggregator.cs
Created March 20, 2016 12:14
A basic async approach for middleware (dolls) using tasks and LINQ aggregate
using System.Diagnostics;
using System.Linq;
using NUnit.Framework;
using System;
using System.Threading.Tasks;
namespace AsyncDollsAggregator
{
[TestFixture]
public class Test
@guardrex
guardrex / CustomMvcRazorHost.cs
Last active June 28, 2016 05:29
Razor Markup Minfier
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.Razor.Directives;
using Microsoft.AspNetCore.Razor;
using Microsoft.AspNetCore.Razor.Chunks;
using Microsoft.AspNetCore.Razor.CodeGenerators;
using Microsoft.AspNetCore.Razor.Parser;
using Microsoft.AspNetCore.Razor.CodeGenerators.Visitors;

It's so sad, these issues diverges the F# community more and more away from Microsoft and it also pushes away F# users

There is a big negative atmosphere about this:

Some tweets (do read the complete twitter threads, there is a lot more behind it) From F# side:

Somewhat disappointed in .NET and #fsharp lately. Where are the greener pastures though? Don't really see that many.

— Kurt Schelfthout (@kurt2001) November 18, 2015
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
@cloudRoutine
cloudRoutine / fs-coreclr-build.md
Last active October 18, 2015 20:59
Build the Visual F# Compiler and Tools for .Net CoreCLR ( On Windows )

Make things easy for yourself and start by running posh as admin

If you already have dnvm installed remember to run update-self if you haven't recently

Clone and checkout the coreclr branch of Kevin Ransom's Fork of the Visual F# Compiler and Tools

Installing DNVM

You need DNVM as a starting point. DNVM enables you to acquire a (or multiple) .NET Execution Environment (DNX).

@swlaschin
swlaschin / ConstrainedTypesExamples.fsx
Last active May 26, 2024 20:19
Examples of creating constrained types in F#
// General hints on defining types with constraints or invariants
//
// Just as in C#, use a private constructor
// and expose "factory" methods that enforce the constraints
//
// In F#, only classes can have private constructors with public members.
//
// If you want to use the record and DU types, the whole type becomes
// private, which means that you also need to provide:
// * a constructor function ("create").
@jashkenas
jashkenas / semantic-pedantic.md
Last active November 29, 2023 14:49
Why Semantic Versioning Isn't

Spurred by recent events (https://news.ycombinator.com/item?id=8244700), this is a quick set of jotted-down thoughts about the state of "Semantic" Versioning, and why we should be fighting the good fight against it.

For a long time in the history of software, version numbers indicated the relative progress and change in a given piece of software. A major release (1.x.x) was major, a minor release (x.1.x) was minor, and a patch release was just a small patch. You could evaluate a given piece of software by name + version, and get a feeling for how far away version 2.0.1 was from version 2.8.0.

But Semantic Versioning (henceforth, SemVer), as specified at http://semver.org/, changes this to prioritize a mechanistic understanding of a codebase over a human one. Any "breaking" change to the software must be accompanied with a new major version number. It's alright for robots, but bad for us.

SemVer tries to compress a huge amount of information — the nature of the change, the percentage of users that wil

interface EventStream
{
// Just a marker interface to let you know which classes are persisted.
}
class Site : EventStream
{
private readonly HashSet<string> _registeredUsers = new HashSet<string>();
public string Id { get; private set; }