Skip to content

Instantly share code, notes, and snippets.

View jcmrva's full-sized avatar

Josh M jcmrva

View GitHub Profile
@maloo
maloo / MemoryMappedFileMemory.cs
Created April 24, 2020 11:37
MemoryMappedFile to Span sample
using System;
using System.Buffers;
using System.IO.MemoryMappedFiles;
namespace VallmoVcdVisualizer.Services
{
unsafe class MemoryMappedFileMemory : MemoryManager<byte>
{
private readonly MemoryMappedFile mmf;
private readonly MemoryMappedViewAccessor ma;
@tomhicks
tomhicks / plink-plonk.js
Last active May 15, 2025 13:25
Listen to your web pages
@Krzysztof-Cieslak
Krzysztof-Cieslak / dsl.fsx
Created November 19, 2019 15:36
Using F# 4.7 implicit yield feature to implement DSL in F#
//Builder represeting only one entity in DSL
type Child1State = {SomeState : string}
type Child1Builder () =
[<CustomOperation("set_state")>]
member __.SetState (st, x) = {st with SomeState = x}
@jbtule
jbtule / fsharp-onboarding.md
Last active October 12, 2021 15:15
F# onboarding from c# - 2018

Set yourself up for using Exercism

http://exercism.io/

To unlock these execerises you will need to disabled learning mode.

Practice c#

In Exercism you'll have some exercises to

@adamralph
adamralph / ci.md
Last active September 9, 2019 21:58
My current assessment of SaaS CI systems

This assessment is performed with respect to the requirements of the .NET community open source projects which I maintain. It is restricted to the free tier provided by each system.

Only the drawbacks are listed, which makes the assessment sound a bit negative, but it's relative to a baseline functional expectation:

  • Linux and Windows
  • Fast provisioning
  • Concurrent builds
  • Common build properties surfaced as env vars (e.g build number)
  • Readable, copyable, and line-linkable log output, supporting ANSI colour codes and code page 437
@swlaschin
swlaschin / FsCsInterop.md
Last active May 14, 2025 07:13
F# to C# interop tips

Tips on exposing F# to C#

Api and Methods

I suggest that you create one or more Api.fs files to expose F# code in a C# friendly way.

In this file:

  • Define functions with PascalCase names. They will appear to C# as static methods.
  • Functions should use tuple-style declarations (like C#) rather than F#-style params with spaces.
// The 'compare' function from FSharp.Core returns a magic number to indicate the result
// compare : 'T -> 'T -> int when 'T : comparison
compare 0 1 //-1
compare 0 0 //0
compare 1 0 //1
// We could clarify our intent
type Leg = Less | Equal | Greater
type Comparer<'T> = 'T -> 'T -> Leg
@gusty
gusty / curry.fsx
Created July 9, 2019 22:13
Polyvariadic curry / uncurry
#nowarn "0042"
let inline retype (x: 'T) : 'U = (# "" x: 'U #)
open System
type Curry =
static member inline Invoke f =
let inline call_2 (a: ^a, b: ^b) = ((^a or ^b) : (static member Curry: _*_ -> _) b, a)
call_2 (Unchecked.defaultof<Curry>, Unchecked.defaultof<'t>) (f: 't -> 'r) : 'args
@mbilokonsky
mbilokonsky / neurdivergent_inventory.json
Created May 28, 2019 01:41
work in progress - inventory of neurodivergent traits
[
{
"name": "sound",
"category": "sensory",
"sense_seeking_question": "I have a stim that involves really loud sound, be that music or machinery or something else.",
"sensitivity_values": [
"A sound needs to be very loud for me to even notice it.",
"I sometimes need to turn the volume up to hear something that others seem to hear just fine",
"I've always felt pretty normal here - my experience seems to be in keeping with that of most people around me.",
@realvictorprm
realvictorprm / Snake.fsx
Last active November 22, 2020 18:00
Snake implementation in F#
module Elmish.Snake
(**
Timer as a source of events with an SVG clock, by Zaid Ajaj.
You can find more info about Emish architecture and samples at https://elmish.github.io/
*)
open System
open Fable.Import
open Fable.Helpers.React