Skip to content

Instantly share code, notes, and snippets.

View jeremiahredekop's full-sized avatar
😀
life is good.

Jeremiah Redekop jeremiahredekop

😀
life is good.
View GitHub Profile
@jkonecki
jkonecki / ConcreteState.cs
Last active November 10, 2018 03:11
Orleans EventSourcing design
using System.Threading.Tasks;
using Orleans;
namespace MyApp
{
public class MyState
{
public string Foo { get; set; }
public int Bar { get; set; }
}
@sebz
sebz / grunt-hugo-lunrjs.md
Last active June 28, 2024 18:41
hugo + gruntjs + lunrjs = <3 search
@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]
@jeremiahredekop
jeremiahredekop / PipingExtensions.cs
Last active July 21, 2017 17:50
Piping c# extension methods
public static class PipingExtensions
{
/// <summary>
/// Take an object, pipe it into a function, and return the result.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <typeparam name="T2"></typeparam>
/// <param name="obj"></param>
/// <param name="f"></param>
/// <returns></returns>
@akimboyko
akimboyko / 01_SayHello.fsx
Last active May 28, 2023 13:00
Samples from "Actor-based Concurrency with F# and Akka.NET" http://bit.ly/FSharpAkkaNET
#time "on"
#load "Bootstrap.fsx"
open System
open Akka.Actor
open Akka.Configuration
open Akka.FSharp
open Akka.TestKit
// #Using Actor
@isaacabraham
isaacabraham / CloudAgent-3.fs
Last active January 15, 2016 23:40
Mailbox Processor in Cloud Agent with automatic dead lettering and at-least-once processing.
let CreateActor (ActorKey name) =
MailboxProcessor.Start(fun mailbox ->
let messageStore = GetMessageStore name
let rec loop data =
async {
// Wait asynchronously until we get a message + reply channel
let! message, replyWith = mailbox.Receive()
match message with
| Clear ->
@isaacabraham
isaacabraham / CloudAgent-2.fs
Last active August 29, 2015 14:10
How to bind a Mailbox Processor to CloudAgent
// A connection to a Azure Service Bus-backed CloudAgent actor pool
let cloudConnection = CloudConnection.ActorCloudConnection(ServiceBusConnection "Endpoint=sb://myservicebus.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=fsdoifsm0983m29048098dfs", Connections.Queue "myqueue")
(* Posting messages - run this code on every producer *)
let sendTo = ConnectionFactory.SendToActorPool CloudConnection
let sendToIsaac = sendTo (ActorKey "isaac")
sendToIsaac Clear |> Async.RunSynchronously // send a message to Clear the file to the Isaac actor
sendToIsaac(Record { Text = "Hello"; Priority = Priority.Low }) |> Async.RunSynchronously // Send a new message to Isaac
(* Consuming messages - run this code on every consumer *)
@isaacabraham
isaacabraham / CloudAgent-1.fs
Last active June 13, 2021 20:38
Local Mailbox Processor
// Our simple domain model
type Priority =
| Low
| Normal
| High
type Message = {
Text : string
Priority : Priority
}
@isaacabraham
isaacabraham / 1 - StorageQueueMailboxProcessor.fs
Last active August 15, 2020 09:36
Demonstrates how to use F# mailbox processors in conjunction with Azure Storage Queues.
/// Code to bind mailbox processors to azure storage queues.
module AzureMailboxProcessor
open System
module private Async =
let AwaitTaskEmpty = Async.AwaitIAsyncResult >> Async.Ignore
module private Option =
let fromNullable (nullable:Nullable<_>) = if nullable.HasValue then Some nullable.Value else None
let toNullable = function
@eulerfx
eulerfx / EventStore.fsi
Last active August 29, 2015 14:03
F# EventStore API
type Stream = string
type EventType = string
type ExpectedVersion = int
type EventData = byte[]
type EventMetadata = byte[]
type ResolveLinks = bool
type From = int
type BatchSize = int
type BufferSize = int
type CheckpointStore = (unit -> Async<int option>) * (int -> Async<unit>)