Skip to content

Instantly share code, notes, and snippets.

@eastmad
eastmad / simplestatemachinewithobserver.cs
Last active August 31, 2022 18:59
A sImple state machine for a cycle, with an observer
using System.Diagnostics;
using System.Threading;
using System.Timers;
using TheNewStack;
namespace TheNewStack
{
public enum SeasonalState { Spring, Summer, Autumn, Winter }
public class SimpleStateMachineWithObserver
@eastmad
eastmad / simplestatemachinecycle.cs
Last active August 29, 2022 12:42
Simple State Machine for a cycle
namespace TheNewStack
{
public enum SeasonalState { Spring, Summer, Autumn, Winter }
public class SimpleStateMachine
{
public Season CurrentSeason;
public SimpleStateMachine()
{
require 'sinatra'
get '/hi' do
"<h1>Hello World!</h1 >This is <i style='color:red'>Sinatra</i> doing it my way"
end
get '/bye' do
"<h1>Good Night!</h1>This is <i style='color:blue'>Sinatra</i> signing out at #{Time.now}"
end
require 'sinatra'
get '/hi' do
"Hello World!"
end