This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class EnumerableExtensions | |
{ | |
public static IEnumerable<TSource> PartialOrderBy<TSource, TKey>(this IEnumerable<TSource> source, | |
Func<TSource, TKey> keySelector, | |
IComparer<TKey> comparer) | |
{ | |
var list = new List<TSource>(source); | |
while (list.Count > 0) | |
{ | |
var minimum = default(TSource); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<div id="main"></div> | |
<script src="vendor.js"></script> | |
<script src="bundle.js"></script> | |
</body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
l_events_then_should_throw [FAIL] | |
System.TypeInitializationException : The type initializer for 'System.Data.SqlLocalDb.Logger' threw an exception. | |
---- System.TypeInitializationException : The type initializer for 'System.Data.SqlLocalDb.SqlLocalDbConfig' threw | |
an exception. | |
-------- System.Runtime.Serialization.SerializationException : Type is not resolved for member 'Serilog.Context.Im | |
mutableStack`1[[Serilog.Core.ILogEventEnricher, Serilog, Version=1.5.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a | |
10]],Serilog.FullNetFx, Version=1.5.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10'. | |
Stack Trace: | |
at System.Data.SqlLocalDb.SqlLocalDbApi.GetInstanceNames() | |
at System.Data.SqlLocalDb.SqlLocalDbProvider.GetInstances() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run this from Powershell as Administrator with (New-Object System.Net.WebClient).DownloadString("https://gist.github.com/larsw/fceb8d9b13ddd197c2aa/raw") | powershell -command - | |
Write-Output "Making Windows 10 more developer workstation oriented..." | |
Set-ExecutionPolicy Unrestricted | |
Write-Output "Bloatware removing..." | |
$apps = @( | |
"Microsoft.3DBuilder" | |
"Microsoft.Appconnector" | |
"Microsoft.BingFinance" | |
"Microsoft.BingNews" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm run dev | |
> [email protected] dev /home/larsw/shave | |
> webpack-dev-server --port 8080 --hot --inline | |
http://localhost:8080/ | |
webpack result is served from / | |
content is served from /home/larsw/shave | |
[bootstrap-loader]: Hey, we're in DEBUG mode! Yabba dabba doo! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
var serilog = $.connection.serilogHub; | |
serilog.client.sendLogEvent = function(logEvent) { | |
console.log(logEvent); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.DirectoryServices.AccountManagement; | |
using System.Linq; | |
using System.Security.Claims; | |
using System.Threading.Tasks; | |
using Thinktecture.IdentityServer.Core; | |
using Thinktecture.IdentityServer.Core.Models; | |
using Thinktecture.IdentityServer.Core.Services; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// reference xunit | |
// reference BouncyCastle | |
// reference Security.Cryptography.dll (CLR Security project @ Codeplex) | |
public static byte[] ConvertToNCryptEccPrivateBlob(BigInteger d, ECPoint q) | |
{ | |
// from bcrypt.h: #define BCRYPT_ECDSA_PRIVATE_P384_MAGIC 0x34534345 // ECS4 | |
var magic = new byte[] { 0x45, 0x43, 0x53, 0x34 }; | |
var len = new byte[] { 0x30, 0, 0, 0 }; // key length - 384 bit / 8 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let seqGen a b = | |
seq { | |
yield! seq { a .. b } | |
raise (System.UnauthorizedAccessException("foo")) | |
} | |
try | |
seqGen 1 10 | |
|> Seq.iter (fun x -> printf "%A " x) | |
with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System.UnauthorizedAccessException: Access to the path "/home/larsw/.cache/dconf" is denied. | |
at System.IO.Directory+<EnumerateKind>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0 | |
at [email protected] (IEnumerable`1& next) [0x00000] in <filename unknown>:0 | |
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[System.String].MoveNextImpl () [0x00000] in <filename unknown>:0 | |
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[System.String].System-Collections-IEnumerator-MoveNext () [0x00000] in <filename unknown>:0 | |
at [email protected] (IEnumerable`1& next) [0x00000] in <filename unknown>:0 | |
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[System.String].MoveNextImpl () [0x00000] in <filename unknown>:0 | |
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[System.String].System-Collections-IEnumerator-MoveNext () [0x00000] in <filename unknown>:0 | |
at FSI_0001.Kodekamp+getFiles |