Skip to content

Instantly share code, notes, and snippets.

View jltrem's full-sized avatar

Joe Tremblay jltrem

  • College Station, TX
View GitHub Profile
@jltrem
jltrem / immutable-domain-types-example.cs
Created February 22, 2024 15:28
Immutable Domain Types example
public record Contact
{
public required PersonalName Name { get; init; }
public required EmailAddress Email { get; init; }
}
public record PersonalName
{
public required string First
{

A Few Words from Jimmy Bogard

Jimmy Bogard is the creator/maintainer of Automapper.

Automapper Usage Guidelines

Excerpts from his blog:

  • DO NOT use AutoMapper except in cases where the destination type is a flattened subset of properties of the source type

  • AVOID using AutoMapper when you have a significant percentage of custom configuration in the form of Ignore or MapFrom. The "Auto" is for "automatic" and if it's not "Auto" then don't use this library, it will make things more, not less complicated.

TLS Cipher Suites in Windows 7

That page states:

Windows 7, Windows 8, and Windows Server 2012 are updated by the Windows Update by the 3042058 update which changes the priority order. See Microsoft Security Advisory 3042058 for more information. 

That advisory states: 

The update added additional cipher suites to the default list on affected systems and improved cipher suite priority ordering. 

It has been available in Windows Update since Oct 2015.  Win7 only had one update actually named as a "Service Pack" ... SP1 in 2011.  After that there were many patches pushed via Windows Update.  The first "Convenience Rollup" of these patches was in July 2016.  If you just install that rollup the cipher updates will be included, and it will take care of any pre-reqs. See [July 21, 2016 — KB3172605](https://support.microsoft.com/en-us/

@jltrem
jltrem / namelessFunctionInterface.ts
Created June 11, 2022 16:43
typescript interface for nameless function plus additional properties
interface Foo {
(a:string): void
bar: string
}
const baz = (a: string): void => {
}
baz.bar = ""
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp
{
public static class Program
{
static void Main(string[] args)
{
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading;
using System.Linq;
using LanguageExt;
namespace foo
public class QueuedDemux<T> : IDisposable
module AsyncPeriodicWork =
let createCanceller () =
new System.Threading.CancellationTokenSource()
let start (canceller:System.Threading.CancellationTokenSource) (intervalMillis:int) (work:(unit->unit)) (onFault:(System.Exception->unit) option)=
let loop = async {
printfn "starting..."
try
@jltrem
jltrem / autocreateJSdictFromCsharpEnums2.cs
Last active November 30, 2016 15:30
C# used to create JSON for enums
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MyAppNamespace;
namespace MyAppNamespace.Util
{
public class MyAppInfo
@jltrem
jltrem / autocreateJSdictFromCsharpEnums1.cshtml
Last active November 30, 2016 15:30
Razor to autocreate JS dicts from C# enums
<!-- this should go in _Layout.cshtml -->
@{
string appInfo = MyAppNamespace.Util.MyAppInfo.ToJson();
<script>
window.myAppInfo = @Html.Raw(appInfo);
</script>
}
<!-- then load a js file with the following to extend this global object: