Skip to content

Instantly share code, notes, and snippets.

View StefH's full-sized avatar

Stef Heyenrath StefH

View GitHub Profile
0x10459EA30C46269CD8c0f5D3Be8Ea29e1E4e3f8e
@StefH
StefH / AddressValidator.cs
Last active June 18, 2018 19:43
Nethereum AddressValidator code
using System.Text.RegularExpressions;
using Nethereum.Util;
namespace SupplyChain.BlockChain.Validation
{
/// <inheritdoc cref="IAddressValidator"/>
public class AddressValidator : IAddressValidator
{
private static readonly Regex AddressRegex = new Regex("^0[xX]([A-Fa-f0-9]{40})$");
private static readonly AddressUtil AddressUtil = new AddressUtil();
@StefH
StefH / JsonUtils.cs
Created September 7, 2018 06:12
Generate DynamicLinq Select Statement from a JObject
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WireMock.Util
{
internal static class JsonUtils
{
pool:
vmImage: 'vs2017-win2016'
variables:
buildId: "1$(Build.BuildId)"
# Install SonarScanner
- script: |
dotnet tool install --global dotnet-sonarscanner
# Begin SonarScanner
- script: |
%USERPROFILE%\.dotnet\tools\dotnet-sonarscanner begin . . .
# Build source, tests and run tests netcoreapp2.1 (with coverage)
- script: |
dotnet test project.csproj --logger trx /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
pool:
vmImage: 'vs2017-win2016'
variables:
buildConfiguration: 'Debug'
buildId: "1$(Build.BuildId)"
steps:
# Print buildId
- script: |
@StefH
StefH / ServiceManifest.xml
Created October 6, 2018 14:35
Example Service Fabric ServiceManifest.xml for a Container
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="WireMock_ContainerPkg"
Version="1.0.0"
xmlns="http://schemas.microsoft.com/2011/01/fabric"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ServiceTypes>
<!-- This is the name of your ServiceType.
The UseImplicitHost attribute indicates this is a guest service. -->
<StatelessServiceType ServiceTypeName="WireMock_ContainerType" UseImplicitHost="true" />
using Microsoft.Azure.EventHubs;
using Microsoft.Azure.EventHubs.Processor;
using System;
using System.Text;
using System.Threading.Tasks;
namespace EventHubExampleNew
{
/// <summary>
/// Code based on: