Skip to content

Instantly share code, notes, and snippets.

Avatar

Steve Hebert stevehebert

View GitHub Profile
@stevehebert
stevehebert / function_composition.go
Created Oct 23, 2020
Applying Transition functions
View function_composition.go
p.OnTransition(LogTransitionToKafka).
OnTransition(RecordTransitionMetrics)
@stevehebert
stevehebert / function_composition.go
Created Oct 23, 2020
Example of composing function to operate on the order
View function_composition.go
p.Configure(Claimed).
OnEntry(RecordShopperAssignment).
OnEntry(SendOrderNotification).
OnEntry(UpdateOrderState).
PermitReentry(AddItemToOrder).
Permit(Submit, ArriveAtStore).
Permit(Cancel, Canceled)
@stevehebert
stevehebert / state_definition.go
Last active Oct 23, 2020
Configuring the State Machine
View state_definition.go
p.Configure(Created).
OnEntry(OnNewOrderEntry).
Permit(Open, Opened).
Permit(Cancel, Canceled)
p.Configure(Opened).
OnEntry(OnOrderOpened).
PermitReentry(AddItemToOrder).
Permit(Claim, Claimed).
Permit(Cancel, Canceled)
View function_composer.go
// given a set of functions defined on our interface
type Functions interface {
RecordDelivery(x Order) (Order, error)
ApplyTotals(x Order) (Order, error)
NotifyMember(x Order) (Order, error)
}
// we can now create a function new function that composes these
// into a new ordering
View function_composition.go
// given a set of functions defined on our interface
type Functions interface {
RecordDelivery(x Order) Order
ApplyTotals(x Order) Order
NotifyMember(x Order) Order
}
// we can now create a function new function that composes these
// into a new ordering
View ajax-javascript-mock.coffee
class JQueryAjaxStub
constructor: (timeOut, functionData) ->
@originalAjax = jQuery.ajax
jQuery.ajax = (data) =>
setTimeout( ->
(data.success functionData(data.data))
, timeOut)
@stevehebert
stevehebert / nuspec.xml
Created Jan 21, 2011
nuspec file created with the Albacore::nuspec task
View nuspec.xml
<?xml version="1.0"?>
<package>
<metadata>
<id>fluentworkflow</id>
<version>0.0.8.103</version>
<authors>Steve Hebert</authors>
<description>FluentWorkflow is a workflow/saga dsl and runtime component</description>
<language>en-US</language>
<licenseUrl>http://fluentworkflow.codeplex.com/license</licenseUrl>
<projectUrl>http://fluentworkflow.codeplex.com</projectUrl>