Over the years, Microsoft hired me to write short code samples, published on their developer documentation site, the Microsoft Developer Network (MSDN). Here you’ll find links to those samples on topics ranging from SharePoint Server 2003 up to the current version, SharePoint Online, as well as Microsoft’s Content Management Server (MCMS) 2002.
Code samples

SharePoint 2013 Workflow: Route Workflows to States Depending on Actions & Events
This sample allows a company, such as a cable company, to better manage is fleet of vehicles. A fleet manager workflow instant starts when a new vehicle is added to the fleet (as an item in a SharePoint list).

SharePoint 2013 Workflow: Call a workflow in an app using a remote event receiver
This sample demonstrates how to use remote event receivers to trigger workflows & how to use the CSOM to start an instance of the workflow.

SharePoint 2013 Workflow: Approval workflow that Uses a Custom Initiation Form
This basic workflow scenario supports a document review and approval/reject process. The workflow assigns a task to a reviewer, who evaluates the draft, makes comments as necessary, and then concludes the task by either routing the document back to the writer for revisions.

SharePoint 2013 Workflow: Create a Custom Action
The sample workflow is bound to a list named Customers. After the user enters a value for CustomerID, they can manually run the workflow. The workflow uses the CustomerID to search for the customer using the public Northwind sample OData service.

SharePoint 2013 Workflow: Call an External Web Service
The sample workflow is bound to a list named Customers. After the user enters a value for CustomerID, they can manually run the workflow. The workflow uses the CustomerID to search for the customer using the public Northwind sample OData service.