Skip to content

Instantly share code, notes, and snippets.

@flq
flq / AssemblyPoolRegistrar.cs
Last active Jul 8, 2021
Utility classes for named dependencies (,NET Core, C# 9)
View AssemblyPoolRegistrar.cs
using System;
using System.Linq;
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
namespace DIPlaygroundWebApp.ServiceCollectionInfrastructure
{
public static class AssemblyPoolRegistrar
{
public static AssembliesForRegistration UseBulkRegistration(this IServiceCollection svcCollection,
@flq
flq / dotnet_snippets.txt
Created Aug 16, 2018
Some nice .NET snippets
View dotnet_snippets.txt
.NET snippets
1. Deconstruct a regex match group collection
@flq
flq / nasties.cs
Last active Dec 16, 2017
Ye olde NRE from a ctor call
View nasties.cs
using System;
using System.Runtime.Remoting.Proxies;
internal class Program
{
private static void Main(string[] args)
{
var c = new CrazyObject();
Console.WriteLine(c.Hello());
Console.ReadLine();
}
@flq
flq / GetWSDLs.ps1
Created Aug 17, 2017
Acccess discovery service, download all WSDLs for listed services
View GetWSDLs.ps1
function indent([parameter(ValueFromPipeline)]$Content)
{
$StringWriter = New-Object System.IO.StringWriter
$XmlWriter = New-Object System.XMl.XmlTextWriter $StringWriter
$xmlWriter.Formatting = "indented"
$xmlWriter.Indentation = 2
$Content.WriteContentTo($XmlWriter)
$XmlWriter.Flush()
$StringWriter.Flush()
Write-Output $StringWriter.ToString()
@flq
flq / BitempTests.fs
Last active Dec 16, 2016
Bitemporal code samples
View BitempTests.fs
module BitempTests
type TimePoint<'S> = {
recorded : int;
actual : int;
state : 'S;
}
type HistoryEntry<'S> = {
time : int;
View keybase.md

Keybase proof

I hereby claim:

  • I am flq on github.
  • I am fquednau (https://keybase.io/fquednau) on keybase.
  • I have a public key ASDraf_OUnnhDWmgwKEoWTSV7QHQ1pjDPm0pCCSGME0ttwo

To claim this, I am signing this object:

@flq
flq / IiUnitTests.cs
Last active Dec 30, 2015
Gist for using NMeasure for surplus energy in atmosphere...
View IiUnitTests.cs
using System.Collections.Generic;
using Xunit;
using static NMeasure.U;
using static NMeasure.Tests.IiUnits;
namespace NMeasure.Tests
{
public class IIUnitsTests
{
public IIUnitsTests()
@flq
flq / EntryPoint.ts
Last active Oct 10, 2015
Gists for the blog post porting react app to tyescript
View EntryPoint.ts
import {assign} from 'lodash'
function startModule() {
//etc.
}
global['Project'] = assign(global['Project'] || {}, {
startModule
});
@flq
flq / Permutation.hs
Last active Aug 29, 2015
No-frills permutation code in Haskell
View Permutation.hs
module Permutation where
permutate :: [a] -> [[a]]
permutate [x1,x2] = [[x1,x2],[x2,x1]]
permutate items = concat $ map p $ getEachInFrontOnce items
where
p (x:xs) = map (\items -> [x]++items) $ permutate xs
getEachInFrontOnce items = map (putItemAtIndexToFront items) [0..length items-1]
putItemAtIndexToFront items idx = [items!!idx] ++ take idx items ++ drop (idx+1) items
@flq
flq / CompileHub.cs
Last active Mar 8, 2019
Roslyn Refactoring
View CompileHub.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reactive.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.MSBuild;
namespace ReFuc