Skip to content

Instantly share code, notes, and snippets.

View marcpiechura's full-sized avatar

Marc Piechura marcpiechura

View GitHub Profile
@marcpiechura
marcpiechura / App.xaml.cs
Last active January 28, 2021 14:01
ReactiveUI multiple ui threads
using System.Threading;
using System.Windows;
using System.Windows.Threading;
namespace WpfApp1
{
public partial class App
{
protected override void OnStartup(StartupEventArgs e)
{
type SomeComplexType = First | Second
with static member Decode = Decode.string |> Decode.andThen (function "First" -> Decode.succeed First | "Second" -> Decode.succeed Second | _ -> Decode.fail "unkown prop")
static member Encode s = Encode.string <| match s with First -> "First" | Second -> "Second"
type Domain = {
Prop1 : SomeComplexType
Prop2 : int option
}
// Using Thoth
let theme = createMuiTheme [
ThemeProp.Palette [
PaletteProp.Primary [
PaletteIntentionProp.Light Colors.blue.``300``
PaletteIntentionProp.Main Colors.blue.``500``
PaletteIntentionProp.Dark Colors.blue.``700``
]
]
]
using System;
using System.IO;
using System.Xml;
using Akka.IO;
using Akka.Streams;
using Akka.Streams.Stage;
namespace ConsoleApp1
{
C:\Users\Marc\Documents\Github\akka.net>git remote add fixed https://github.com/Silv3rcircl3/akka.net.git
C:\Users\Marc\Documents\Github\akka.net>git fetch fixed
From https://github.com/Silv3rcircl3/akka.net
* [new branch] Arkatufus -> fixed/Arkatufus
* [new branch] Streams_2.4.12 -> fixed/Streams_2.4.12
* [new branch] Streams_2.4.14 -> fixed/Streams_2.4.14
* [new branch] dev -> fixed/dev
* [new branch] fix_racy_streams_specs -> fixed/fix_racy_streams_specs
* [new branch] fix_streams_specs -> fixed/fix_streams_specs
static void Main(string[] args)
{
var sys = ActorSystem.Create("Test");
var mat = sys.Materializer();
var printActor = sys.ActorOf(dsl => dsl.ReceiveAny((msg, _) => Console.WriteLine(msg)));
var sourceActor = Source.ActorRef<Message<int>>(0, OverflowStrategy.DropBuffer)
.Conflate((_, x) => x)
.SelectAsync(1, async m =>
{
@marcpiechura
marcpiechura / changes.txt
Last active August 29, 2016 14:23
changes
https://github.com/akka/akka/pull/19812 done
https://github.com/akka/akka/pull/19835 done
https://github.com/akka/akka/pull/19880 done
https://github.com/akka/akka/pull/19886 done
https://github.com/akka/akka/pull/19864 done
https://github.com/akka/akka/pull/19982 done
https://github.com/akka/akka/pull/19845 done
https://github.com/akka/akka/pull/20026 done
https://github.com/akka/akka/pull/19701 done
https://github.com/akka/akka/pull/20035 done
var completion = new TaskCompletionSource<string>();
var task = Source.FromTask(completion.Task);
var unfold = Source.UnfoldAsync(0, _ => reader.ReadLineAsync().ContinueWith(x => Tuple.Create(0, x.Result)));
var source = task.Concat(unfold);
var materialized = source.Take(1000000L)
//...
.RunFold(new List<string>(), (acc, x) =>
{
acc.Add(x);
/// <summary>
/// Collection of callbacks for an input port of a <see cref="GraphStage{TShape}"/>
/// </summary>
public interface IInHandler
{
/// <summary>
/// Called when the input port has a new element available. The actual element can be retrieved via the <see cref="GraphStageLogic.Grab{T}"/> method.
/// </summary>
void OnPush();
@marcpiechura
marcpiechura / mesaage_serialzer.cs
Created December 30, 2015 17:23
Akka io serializer
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Akka.Actor;
using Akka.IO;
namespace Akka.Signal
{
public static class MessageSeriliazer