Skip to content

Instantly share code, notes, and snippets.

View awright18's full-sized avatar

Adam Wright awright18

View GitHub Profile
namespace EqualityComparer
{
using System.Collections;
using System.Collections.Generic;
public class GenericEqualityComparer<T> : IEqualityComparer<T>
{
public static GenericEqualityComparer<T> Create()
{
using System;
using System.Collections.Generic;
using System.Data;
using OfficeOpenXml;
namespace ExcelExport
{
internal class DataTableExcelExporter
{
private readonly IEnumerable<string> _columnsToHide;
@awright18
awright18 / Microsoft.Powershell_profile.ps1
Created February 3, 2017 19:50
Powershell Profile wiht VSVars already set
function Get-Batchfile ($file) {
$cmd = "`"$file`" & set"
cmd /c $cmd | Foreach-Object {
$p, $v = $_.split('=')
Set-Item -path env:$p -value $v
}
}
function VsVars32($version = "14.0")
{
<# $key = "HKLM:SOFTWARE\Microsoft\VisualStudio\" + $version
@awright18
awright18 / ProjectChooser.cs
Created February 4, 2017 17:29 — forked from uluhonolulu/ProjectChooser.cs
Custom VS Project Template Wizard
static class ProjectChooser
{
private static Project _webProject;
public static void FixOutputPath(this Project project) {
var webProject = project.DTE.Solution.FindWebProject();
SetOutputPathTo(project, webProject);
}
public static void AddMvcReference(this Project project) {
//chunk records by 100
let longSeq = [1..10000]
let size = 100
let foo (x:IEnumerable<int>) = x |> Seq.iter (fun x -> printf "%i" x)
longSeq |> Seq.chunkBySize size |> Seq.iter (fun seq -> foo seq)
@awright18
awright18 / Sample.fsproj
Last active March 27, 2020 11:24
F# http reqeust with HttpClient
<Project Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="rss.fs" />
@awright18
awright18 / NotEnums.cs
Created July 11, 2017 18:09
A way to avoid having to use enums
using System;
namespace NotEnums
{
public class Options
{
public string Value { get; private set; }
private const string Option1 = "Option1";
private const string Option2 = "Option2";
@awright18
awright18 / dotnetlayout.md
Last active July 18, 2017 18:34 — forked from davidfowl/dotnetlayout.md
.NET project structure
$/
  .vscode/
  .fake/
  .nuget/
    nuget.exe
    nuget.config
  .paket/
    paket.bootstrapper.exe
    paket.targets
@awright18
awright18 / template.json
Last active October 20, 2017 08:40
dotnet new template.json intializing a git repository
{
"$schema": "http://json.schemastore.org/template",
"author": "Adam",
"classifications": [ "classlib" ],
"name": "My class lib",
"identity": "Adam.ClassLib2.CSharp",
"groupIdentity":"MyClassLib",
"shortName": "MyClassLib", // You can create the project using this short name instead of the one above.
"tags": {
@awright18
awright18 / Result.cs
Created April 26, 2018 11:58
Functional Result in C#
using System;
using System.Runtime.InteropServices.ComTypes;
namespace Result
{
public static class Result
{
public static Result<T,TError> Ok<T,TError>(T value)
{