Skip to content

Instantly share code, notes, and snippets.

View jimmcslim's full-sized avatar

James Webster jimmcslim

  • Brisbane, Australia
View GitHub Profile
@swlaschin
swlaschin / effective-fsharp.md
Last active June 16, 2024 18:41
Effective F#, tips and tricks

Architecture

  • Use Onion architecture

    • Dependencies go inwards. That is, the Core domain doesn't know about outside layers
  • Use pipeline model to implement workflows/use-cases/stories

    • Business logic makes decisions
    • IO does storage with minimal logic
    • Keep Business logic and IO separate
  • Keep IO at edges

@JakeGinnivan
JakeGinnivan / Bridge.cs
Created September 12, 2015 13:41
XUnit to LibLog Bridge
// Simple bridge to allow capturing of LibLog log messages in xUnit 2.0 tests
// Usage:
private readonly ITestOutputHelper _outputHelper;
public Example(ITestOutputHelper outputHelper) { _outputHelper = outputHelper; }
[Test]
public void Test()
{
using (LogHelper.Capture(_outputHelper, LogProvider.SetCurrentLogProvider))
{
// Call library code, log messages will be captured
@aaronpowell
aaronpowell / StringTypeProvider.fs
Created February 6, 2015 11:02
A basic Type Provider for taking a string and making something silly.
namespace Samples.FSharp.StringTypeProvider
open System
open System.Reflection
open Samples.FSharp.ProvidedTypes
open Microsoft.FSharp.Core.CompilerServices
open Microsoft.FSharp.Quotations
[<TypeProvider>]
type StringTypeProvider(config: TypeProviderConfig) as this =
@dwilliamson
dwilliamson / gist:e9b1ba3c684162c5a931
Last active December 20, 2021 19:38
Workflow for using git subtree on Windows
To include a library as a subtree, follow these steps:
1. Add the project as a remote
git remote add <remote-name> <source-repo>
2. Fetch the remote
git fetch <remote-name>
3. Add the project
git subtree add --prefix "path/to/project" <remote-name> <remote-branch-name> --squash
@taylorkj
taylorkj / gist:9012616
Last active March 27, 2021 14:16
How to use Dapper's new Table Valued Parameter (TVP) in C#
/*
I wasn't able to find a single example on how to actually use Dapper's new TVP, so I though I'd add one.
First of all, you will need to install the Dapper.TVP package from NuGet.
The main item to note is the need to create and populate a list of SqlDataRecords. This is then used to used as part of the
input parameter for Dapper's TableValueParameter.
The API is thus:
@tbrianjones
tbrianjones / beach_volleyball_sand_workouts.md
Last active May 24, 2022 07:04
Sand workouts based on beach volleyball drills and gameplay.

Beach Volleyball Sand Workout

Workout Notes

  • workout time
    • most exercises will take 1:30-2:00 minutes ( with windsprint and rest )
    • 3x through 8 of these will be roughly 45min
  • windsprints between each workout ( roughly ~10-15 seconds, full speed )
  • 30 seconds after each windsprint ( adjust accordingly to keep heart rate up )
// Only let input Observable fire every 'n' seconds at most
// but unlike Throttle, items fire immediately when they aren't
// rate-limited.
public IObservable<T> RateLimit<T>(this IObservable<T> This, TimeSpan interval, IScheduler scheduler)
{
var slot = default(IObservable<Unit>);
var input = This.Publish().RefCount();
return input.Window(input, _ => {
if (slot != null) return slot;
@ragingwind
ragingwind / Backend Architectures Keywords and References.md
Last active July 4, 2024 13:00
Backend Architectures Keywords and References