Skip to content

Instantly share code, notes, and snippets.

View yreynhout's full-sized avatar
👔
ceci n'est pas une cravate

Yves Reynhout yreynhout

👔
ceci n'est pas une cravate
View GitHub Profile
@mrange
mrange / json_transform.md
Last active January 23, 2017 06:53
Monadic JSON Transformers in F#
@mnadel
mnadel / ThrottledTplDataflowPipelne.cs
Last active May 25, 2020 17:47
Applying Backpressure (aka Throttling) in TPL Dataflow
using System.Threading;
using System.Threading.Tasks.Dataflow;
class Pipeline<T>
{
private readonly SemaphoreSlim _semaphore;
private readonly BufferBlock<T> _buffer;
Pipeline(Action<T> action, int capacity)
{
@pbolduc
pbolduc / EventStoreScriptExtensionProvisionFile.ps1
Last active January 29, 2016 13:33
Create Event Store Cluster Azure VMs
param (
[Int]
$clusterSize,
[string]
$VMName,
[Int]
$nodeNumber,
[Int]
$IntIp,
[Int]
@adamchester
adamchester / states.fs
Last active July 4, 2018 00:25
Describing a state machine / approval workflow in F#
type State = Initial | Draft | PendingApproval | Approved | Cancelled | Completed
type Action = Create | Cancel | SendForApproval | Approve | Reject | Complete
type Role = Creator | Approver | Completor
type Transition = { Action:Action; From:State; To:State; Roles:Role list }
module Transitions =
let create = { Action=Create; From=Initial; To=Draft; Roles=[ Creator ] }
let cancel = { Action=Cancel; From=Draft; To=Cancelled; Roles=[ Creator ] }
let sendForAppr = { Action=SendForApproval; From=Draft; To=PendingApproval; Roles=[ Creator ] }
let approve = { Action=Approve; From=PendingApproval; To=Approved; Roles=[ Approver ] }
let reject = { Action=Reject; From=PendingApproval; To=Draft; Roles=[ Approver ] }
@panesofglass
panesofglass / MidFuncAsClass.cs
Last active February 18, 2016 15:42
Quick hack to adapt the current HttpMessageHandlerAdapter to the OWIN signatures
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using AppFunc = Func<IDictionary<string, obj>, Task>;
using MidFunc = Func<AppFunc, AppFunc>;
public class MidFuncType
{
private readonly AppFunc next;
@jbogard
jbogard / rebase.ps1
Created January 28, 2014 17:34
Auto rebase all the things
git config --global push.default tracking
git config --global branch.autosetuprebase always
git config --local branch.master.rebase true
@dashed
dashed / github-pandoc.css
Created September 26, 2013 13:42
GitHub-like CSS for pandoc standalone HTML files (perfect for HTML5 output). Based on Marked.app's GitHub CSS. Added normalize.css (v2.1.3) in the prior to GitHub css.
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined in IE 8/9.
*/
@killercup
killercup / pandoc.css
Created July 3, 2013 11:31
Add this to your Pandoc HTML documents using `--css pandoc.css` to make them look more awesome. (Tested with Markdown and LaTeX.)
/*
* I add this to html files generated with pandoc.
*/
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
@bartelink
bartelink / PostProcessWhereIsACustomization.cs
Last active September 11, 2020 08:00
AutoFixture customization to allow insertion of arbitrary postprocessing logic a la Customize( c=>c.Do()) but in a global manner Revised for v3 (initally for v2)
namespace Ploeh.AutoFixture
{
using Kernel;
using System;
public class PostProcessWhereIsACustomization<T> : ICustomization
where T : class
{
readonly PostProcessSpecimensBehavior _behavior;