Skip to content

Instantly share code, notes, and snippets.

View pobiega's full-sized avatar

Robin Rexstedt pobiega

  • Sweden
View GitHub Profile
@pobiega
pobiega / AsyncEvents.cs
Created September 15, 2023 07:48
C# async event handler
namespace TestingConsoleApp.AsyncEvents;
public static class Program
{
public static async Task Run()
{
var eventHolder = new EventHolder();
eventHolder.OnEvent.OnInvoke += FirstHandler;
eventHolder.OnEvent.OnInvoke += SecondHandler;
@pobiega
pobiega / sean.patch
Created February 21, 2023 15:52
Add a second navigation command to existing viewmodel
diff --git forkSrcPrefix/src/Reservoom/ViewModels/ReservationListingViewModel.cs forkDstPrefix/src/Reservoom/ViewModels/ReservationListingViewModel.cs
index 9f2a60488b0603510f336f7d70b16d3f8a49981c..68f1b035245bc9d39952eb4315fdb6ca102ed47a 100644
--- forkSrcPrefix/src/Reservoom/ViewModels/ReservationListingViewModel.cs
+++ forkDstPrefix/src/Reservoom/ViewModels/ReservationListingViewModel.cs
@@ -58,13 +58,18 @@ namespace Reservoom.ViewModels
public ICommand LoadReservationsCommand { get; }
public ICommand MakeReservationCommand { get; }
- public ReservationListingViewModel(HotelStore hotelStore, NavigationService<MakeReservationViewModel> makeReservationNavigationService)
+ public ICommand EatCakeCommand { get; }
@pobiega
pobiega / ToMarkdownTable.cs
Created August 9, 2022 11:37
Modified version that now supports filtering and ordering of columns
// Original source from https://github.com/jpierson/to-markdown-table
// LICENSE: MIT
public static class LinqMarkdownTableExtensions
{
public static string ToMarkdownTable<T>(this IEnumerable<T> source, params string[] order)
{
var properties = typeof(T).GetRuntimeProperties();
var fields = typeof(T)
.GetRuntimeFields()
@pobiega
pobiega / elevator.rs
Last active February 11, 2019 11:20
Simple elevator implementation in rust
use std::cmp;
#[derive(Debug)]
struct Elevator {
max_floor: u16,
current_floor: u16
}
impl Elevator {
fn new(max_floors: u16) -> Elevator {