Skip to content

Instantly share code, notes, and snippets.

View BennieCopeland's full-sized avatar

Bennie Copeland BennieCopeland

View GitHub Profile
@BennieCopeland
BennieCopeland / describe_execution_order.cs
Last active January 4, 2016 01:52
Changes to NSpec docs to show execution order
using NSpec;
using System;
namespace NSpecExecutionOrder
{
abstract class parent_class : nspec // this can be either an abstract class, or just a class
{
public const int indentSize = 3;
public static string order = "\n\n";
public static int indent = 0;
@BennieCopeland
BennieCopeland / AggregateNotFoundException.cs
Last active January 15, 2018 04:48
Basic domain objects
using System;
/// <summary>
/// The exception is thrown when the requested aggregate is not found by the <see cref="IEventStore"/> implementation.
/// </summary>
public class AggregateNotFoundException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="AggregateNotFoundException"/> class.
/// </summary>
@BennieCopeland
BennieCopeland / app.component.ts
Created June 20, 2017 13:23
Angular2 Webpack configs including Bootstrap 4 and Font-Awesome
import { Component } from '@angular/core';
import '../css/styles.scss';
@Component({
selector: 'iatss-app',
templateUrl: './app.component.html'
})
export class AppComponent {
}
@BennieCopeland
BennieCopeland / example.cs
Created December 29, 2017 16:09
DDD Example
public class HouseId : IEquatable<HouseId>
{
private readonly string id;
public HouseId(string id)
{
this.id = id;
}
public bool Equals(HouseId other)
{
@BennieCopeland
BennieCopeland / CreateCertificates.ps1
Created May 1, 2018 21:37
Creates a Root CA, Server, and Client Certificate and installs them
# setup certificate properties including the commonName (DNSName) property for Chrome 58+
$root = New-SelfSignedCertificate `
-Type Custom `
-KeySpec Signature `
-Subject "CN=DevRootCert" `
-KeyExportPolicy Exportable `
-HashAlgorithm SHA256 `
-KeyLength 2048 `
-CertStoreLocation "Cert:\CurrentUser\My" `
-FriendlyName "Root CA Certificate for .NET Core" `
open System
type private DataGridHelper =
static member inline IsValidRow (this: DataGrid<_,_,_>) row = row < this.rowInfo.Length && row >= 0
static member inline IsValidCol (this: DataGrid<_,_,_>) col = col < this.colInfo.Length && col >= 0
static member inline EnsureValidRow (this: DataGrid<_,_,_>) row = if not (DataGridHelper.IsValidRow this row) then raise (new IndexOutOfRangeException("row")) // TODO: F# vNext nameof(row)
static member inline EnsureValidCol (this: DataGrid<_,_,_>) col = if not (DataGridHelper.IsValidCol this col) then raise (new IndexOutOfRangeException("col")) // TODO: F# vNext nameof(col)
and DataGrid<'TRowInfo, 'TColInfo, 'TElement> =
private { rowInfo: 'TRowInfo[]; colInfo: 'TColInfo[]; elements: Map<int*int, 'TElement> }
@BennieCopeland
BennieCopeland / IndexFileBasePathTransformer.cs
Last active July 17, 2020 12:22
Transforms an index.html file to update the base path href
public class IndexFileBasePathTransformer
{
private static readonly ReaderWriterLockSlim Rw = new ReaderWriterLockSlim();
private static string _indexHtml = "";
private static bool _transformed;
public static void Transform(string contentRootPath, string basePath, ILogger logger)
{
Rw.EnterUpgradeableReadLock();
if (!_transformed)
@BennieCopeland
BennieCopeland / improving-as-a-software-developer.md
Created October 20, 2020 09:15 — forked from Kavignon/improving-as-a-software-developer.md
Always hungry for more. This is a list of resources I've used or that I plan to use as a way to improve my knowledge and technical skills as a software developer.

Some of the books I'll be recommending are based on .NET. Do not be discouraged. We shouldn't strive to stick to a specific technology stack. Your ambitions and goals will evolve over time and that might lead you a completely new space. Moreover, there are lessons to be learned from an environment that's different from what you're used to.

Software Development

@BennieCopeland
BennieCopeland / gist:a69253779bd5b09a088d14a149822b0e
Last active August 26, 2021 13:48 — forked from theburningmonk/gist:3363893
F# - converting a C# dictionary to a Map
let inline toMap kvps =
kvps
|> Seq.map (|KeyValue|)
|> Map.ofSeq
@BennieCopeland
BennieCopeland / pbt.fsx
Created April 21, 2022 09:52
F# version of John Hughes talk https://youtu.be/zvRAyq5wj38
#r "nuget:FsCheck"
open System
open FsCheck
module JohnHughes =
// F# version of John Hughes talk https://youtu.be/zvRAyq5wj38
type BST<'k, 'v when 'k : comparison> =
| Leaf