Skip to content

Instantly share code, notes, and snippets.

View Stephanvs's full-sized avatar

Stephan van Stekelenburg Stephanvs

View GitHub Profile
@Stephanvs
Stephanvs / DynamicJsonDeserializer.cs
Created February 22, 2012 18:54 — forked from rdingwall/DynamicJsonDeserializer.cs
RestSharp deserialize JSON to dynamic
// ReSharper disable CheckNamespace
namespace RestSharp.Deserializers
// ReSharper restore CheckNamespace
{
public class DynamicJsonDeserializer : IDeserializer
{
public string RootElement { get; set; }
public string Namespace { get; set; }
public string DateFormat { get; set; }
namespace BenjiiMe.Animation
{
public class ContinuumTransition : TransitionElement
{
public const string ContinuumElementPropertyName = "ContinuumElement";
public const string ContinuumModePropertyName = "Mode";
public FrameworkElement ContinuumElement
{
get { return (FrameworkElement)GetValue(ContinuumElementProperty); }
<Grid x:Name="LayoutRoot" Width="37" Height="42" Visibility="Collapsed" Opacity="0">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState x:Name="DefaultState">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Visibility"
BeginTime="0:0:0.2">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Opacity"
@Stephanvs
Stephanvs / Home.xml
Last active August 29, 2015 14:07 — forked from Cheesebaron/Home.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<dk.ostebaronen.droid.viewpagerindicator.TitlePageIndicator
android:id="@+id/viewPagerIndicator"
android:padding="10dip"
@Stephanvs
Stephanvs / Home.xml
Last active August 29, 2015 14:07 — forked from Cheesebaron/Home.xml
A couple of code snippets for a blog post about Fragments, ViewPager and MvvmCross.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<dk.ostebaronen.droid.viewpagerindicator.TitlePageIndicator
android:id="@+id/viewPagerIndicator"
android:padding="10dip"
/*
* Copyright (C) 2014 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@Stephanvs
Stephanvs / PublisherActor.cs
Created August 5, 2016 21:12 — forked from LarsKemmann/PublisherActor.cs
Service Fabric pub/sub using ActorEvents
public interface IPublisherEvents
{
void OnPublished(object value);
}
public interface IPublisher : IActor, IActorEventPublisher<IPublisherEvents>
{
Task PublishAsync(object value);
}
@Stephanvs
Stephanvs / EventMachines.md
Created February 5, 2018 11:09 — forked from eulerfx/EventMachines.md
The relationship between state machines and event sourcing

A state machine is defined as follows:

  • Input - a set of inputs
  • Output - a set of outputs
  • State - a set of states
  • S0 ∈ S - an initial state
  • T : Input * State -> Output * State - a transition function

If you model your services (aggregates, projections, process managers, sagas, whatever) as state machines, one issue to address is management of State. There must be a mechanism to provide State to the state machine, and to persist resulting State for subsequent retrieval. One way to address this is by storing State is a key-value store. Another way is to use a SQL database. Yet another way is event sourcing. The benefit of even sourcing is that you never need to store State itself. Instead, you rely on the Output of a service to reconstitute state. In order to do that, the state machine transition function needs to be factored into two functions as follows:

@Stephanvs
Stephanvs / Arduino Song
Created August 14, 2019 07:24 — forked from eznj/star_wars.ino
Arduino Star Wars Song for Piezo
**/
const int c = 261;
const int d = 294;
const int e = 329;
const int f = 349;
const int g = 391;
const int gS = 415;
const int a = 440;
const int aS = 455;