Skip to content

Instantly share code, notes, and snippets.

View mlaily's full-sized avatar

Melvyn Laïly mlaily

View GitHub Profile
@mbuhot
mbuhot / FSharpConverters.fs
Last active November 5, 2023 20:16
System.Text.Json converters for F# Option, List and Map types
namespace System.Text.Json
open System
open System.Collections.Generic
open System.Text.Json.Serialization
// Converts Option<T> to/from JSON by projecting to null or T
type OptionValueConverter<'T>() =
inherit JsonConverter<'T option>()
@swlaschin
swlaschin / effective-fsharp.md
Last active July 23, 2024 10:39
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

@sinclairtarget
sinclairtarget / 1-cat-pdp7.s
Last active April 2, 2024 20:15
cat through the ages
" cat
lac 017777 i " Load accumulator (AC) with argument count
sad d4 " Skip next if we have more than 4 words of args
jmp nofiles " Otherwise, jump to nofiles
lac 017777 " Load AC with address of args
tad d1 " Increment AC by 1, past argument count
tad d4 " Increment AC by 4, now AC points to first real arg
dac name " Save arg pointer from AC into 'name'
@Arnold1
Arnold1 / screen_capture.cpp
Created October 24, 2016 21:18
screen capture example with threading
// adapted code from http://www.codeproject.com/Tips/1116253/Desktop-Screen-Capture-on-Windows-via-Windows-Desk
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <shlobj.h>
#include <shellapi.h>
#include <dxgi1_2.h>
#include <d3d11.h>
#include <memory>
@Arnold1
Arnold1 / screen_capture.cpp
Last active February 27, 2023 17:31
screen capture example
// adapted code from http://www.codeproject.com/Tips/1116253/Desktop-Screen-Capture-on-Windows-via-Windows-Desk
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <shlobj.h>
#include <shellapi.h>
#include <dxgi1_2.h>
#include <d3d11.h>
#include <memory>
@davidfowl
davidfowl / Example1.cs
Last active June 19, 2024 16:41
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)
@erikcox
erikcox / SimCityLoadingMessages.txt
Created November 11, 2015 21:23
A list of loading messages from the game SimCity, which I repurposed for Slack loading messages.
Adding Hidden Agendas
Adjusting Bell Curves
Aesthesizing Industrial Areas
Aligning Covariance Matrices
Applying Feng Shui Shaders
Applying Theatre Soda Layer
Asserting Packed Exemplars
Attempting to Lock Back-Buffer
Binding Sapling Root System
Breeding Fauna
using System.ComponentModel;
using System.Globalization;
using System.Resources;
using System.Windows.Data;
public class TranslationSource
: INotifyPropertyChanged
{
private static readonly TranslationSource instance = new TranslationSource();
@imjasonh
imjasonh / markdown.css
Last active May 24, 2024 22:56
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@joelverhagen
joelverhagen / RedirectingHandler.cs
Last active January 16, 2024 05:04
RedirectingHandler
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace Knapcode.Http.Handlers
{