Skip to content

Instantly share code, notes, and snippets.

View jsquire's full-sized avatar

Jesse Squire jsquire

View GitHub Profile
@jsquire
jsquire / phantomjs-launcher-pure.ps1
Last active May 22, 2018 15:43
A PhantomJS launcher script in pure PowerShell
<#
.SYNOPSIS
Launches and controls a console test run using PhantomJS
.DESCRIPTION
Launches a console test run using PhantomJS by passing a custom runner script. Output from the test run is captured by this script to allow
for a rudimentary colorization syntax such that the console messages can be colored in the Windows command prompt.
For more detailed help, please use the -Help switch.
#>
@jsquire
jsquire / phantomjs-launcher-hybrid.ps1
Last active August 29, 2015 14:16
A PhantomJS launcher script, using a hybrid approach with inline C# for observing the output event
<#
.SYNOPSIS
Launches and controls a console test run using PhantomJS
.DESCRIPTION
Launches a console test run using PhantomJS by passing a custom runner script. Output from the test run is captured by this script to allow
for a rudimentary colorization syntax such that the console messages can be colored in the Windows command prompt.
For more detailed help, please use the -Help switch.
#>
@jsquire
jsquire / FsUnitSample.fs
Created February 19, 2018 15:13
A sample to illustrate the various structures that can be used for tests with F# and FSUnit.
namespace MachineLearningBook.SpamDetector.UnitTests
module SampleTests =
open System
open Xunit
open FsUnit.Xunit
// http://fsprojects.github.io/FsUnit/index.html
// http://fsprojects.github.io/FsUnit/xUnit.html
[<Fact>]
@jsquire
jsquire / FSUnitTheoryDataMemberSample.fs
Created February 19, 2018 15:15
A sample illustrating the syntax for using a data member source for an xUnit theory with F# and FsUnit
namespace MachineLearningBook.SpamDetector.UnitTests
module DataSetTests =
open System
open FSharp.Reflection
open MachineLearningBook.SpamDetector
open Xunit
open FsUnit.Xunit
type ``Parsing a DocType should produce the expected results`` () =
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace SomeApp.Infrastructure
{
/// <summary>
/// The set of extension methods for the <see cref="HttpRequestMessage" />
/// class.

.NET Event Hubs Client: Streaming Receive Concept (Second Preview)

When receiving events, Event Hubs typically offers two different conceptual approaches: requesting a batch of events or receiving events as they are published, whether by pull (iterating against a generator) or push (callback handler). The approach used for implementation varies by language, with the track one .NET client opting for push-via-callback.

Concepts to Consider for .NET in Track 2

IAsnyc Enumerable

var client = new EventHubClient("&lt;&lt; Connection String &gt;&gt;", "SomeHub");

.NET Event Hubs Client: Retry with Timeout Concept (Second Preview)

Because Event Hubs is based on the AMQP protocol, there is no request/response cycle that defines an operation. Both the Event Hubs client and service make use of an operation timeout as means of coordination for managing their resources. When communicating with the Event Hubs service, the client library is required to specify an operation timeout on the AMQP link.

If an operation has not been completed within this timeout period, the client library will consider it a transient failure and apply its retry policy. Likewise, if the server is expecting communication from the client, such as a message acknowledgment, that does not occur within the timeout period, it will consider the operation to have failed.

Operation Timeouts and Cancellations, Oh My!

The guidance for .NET design has been to strongly prefer cancellation tokens with timeout over explicit timeouts. However, this presents a challenge in the case of Event Hubs where t

@jsquire
jsquire / strawman.md
Last active January 2, 2020 15:15
Event Hubs Client: October Strawman

Event Hubs Client: October Strawman (Preview 5)

This design is focused on the fifth preview of the track two Event Hubs client library, and limits the scope of discussion to those areas with active development for that preview. For wider context and more general discussion of the design goals for the track two Event Hubs client, please see:

Things to know before reading

  • The names used in this document are intended for illustration only. Some names are not ideal and may not fully conform to guidelines; these will be refined during prototyping and board reviews.

.NET Event Hubs Client: Skeleton (January, 2020)

This skeleton represents the public API surface of the .NET Event Hubs client libraries in skeletal form, as they were proposed and reviewed for the preview 6 and January 2020 milestone releases.

Package: Azure.Messaging.EventHubs

Azure.Messaging.EventHubs

public class EventHubConnection : IAsyncDisposable 
{
@jsquire
jsquire / iot-hub-connection.md
Last active November 9, 2020 13:44
IoT Hub: Connection String Translator Proposal

IoT Hub: Connection String Translator Proposal

IoT Hub is a managed service that acts as a central message hub for bi-directional communication between an IoT application and the devices it manages. IoT Hub supports communications both from the device to the cloud and from the cloud to the device. IoT Hub supports multiple messaging patterns and may be integrated with other Azure services to build complete, end-to-end solutions.

One of the Azure services that IoT Hub is frequently integrated with is Azure Event Hubs. This document describes a proposed approach to helping developers using IoT Hub leverage the Event Hubs client library.

Things to know before reading

  • The names used in this document are intended for illustration only. Some names are not ideal and will need to be refined during discussions.