Skip to content

Instantly share code, notes, and snippets.

VinceAvery

Block or report user

Report or block VinceAvery

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@VinceAvery
VinceAvery / CSharpClassWriter.cs
Last active Nov 13, 2018
Add attributes to CSHarp Classes
View CSharpClassWriter.cs
public class CSharpClassRewriter : CSharpSyntaxRewriter {
private readonly string _sourceCode;
private readonly Attribute _attributeToAdd;
public CSharpClassRewriter(
string sourceCode,
Attribute attributeToAdd = null) {
if (string.IsNullOrEmpty(sourceCode)) {
throw new ArgumentNullException(nameof(sourceCode));
@VinceAvery
VinceAvery / ISINValidator
Last active Oct 27, 2017
A validator to check a financial identifier called an ISIN, an International Securities Identification Number. It has the ability to both calculate the checksum and validate the complete ISIN, and also it is simple to understand, with as few methods as possible.
View ISINValidator
namespace ConsoleApplication.Validators {
public interface IIsinValidator {
bool IsChecksumCorrect(string dataWithChecksum, bool checkLastDigit);
}
public class IsinValidator : IIsinValidator {
public bool IsChecksumCorrect(string dataWithChecksum, bool checkLastDigit) {
try {
@VinceAvery
VinceAvery / JsonNetSerialization.fsx
Created Mar 16, 2017
Demonstrates how to change the shape of the Json for union tyes in F# when using the Json.NET serializer.
View JsonNetSerialization.fsx
#load "Scripts\load-references-debug.fsx"
open Microsoft.FSharp.Reflection
open Newtonsoft.Json
open Newtonsoft.Json.Linq
open System
// ***************** Domain *****************
type SingleCaseUnion = SingleCaseUnion of int
You can’t perform that action at this time.