Skip to content

Instantly share code, notes, and snippets.

View dburriss's full-sized avatar

Devon Burriss dburriss

View GitHub Profile
@dburriss
dburriss / TextToList.fsx
Last active June 23, 2018 06:09
A F# script file showing parsing text to a typed list. Run with `fsi.exe TextToList.fsx`
open System
type Type1 = {
val1:string
val2:string
}
type Type2 = {
val1:string
val2:string
@dburriss
dburriss / print-binding-redirects.ps1
Created February 27, 2018 20:57
Print out the binding redirects in a bin folder. Run from the build output directory.
function Find-Dlls() {
$dlls = Get-ChildItem | ? { $_.Extension -eq '.dll' } | % { [System.Reflection.AssemblyName]::GetAssemblyName($_.FullName).FullName }
return $dlls
}
function Set-Bindings() {
$binding = "<dependentAssembly>
<assemblyIdentity name=`"{0}`" publicKeyToken=`"{2}`" culture=`"neutral`" />
<bindingRedirect oldVersion=`"0.0.0.0-{1}`" newVersion=`"{1}`" />
@dburriss
dburriss / create-solution.ps1
Created July 14, 2017 09:20
Powershell command for creating a skeleton .net core solution
param (
#[string]$server = "http://defaultserver",
[Parameter(Mandatory=$true)][string]$domain
#[string]$password = $( Read-Host "Input password, please" )
)
# assumes in folder you want solution
# assumes dotnet CLi is on the PATH
# global vars
@dburriss
dburriss / fact.snippet
Created June 28, 2017 06:08
An XUnit fact snippet for Visual Studio. Navigate to Tool > Code Snippets Manager... (or press Ctrl+K, Ctrl+B)
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>XUnit Fact method</Title>
<Author>Devon Burriss</Author>
<Description>Creates a method that will run as an XUnit test (fact).</Description>
<Shortcut>fact</Shortcut>
</Header>
@dburriss
dburriss / FactResharper
Created June 28, 2017 05:42
An XUnit fact snippet for Resharper. Go to Resharper >> Tools >> Templates Explorer. Put under C#.
[Fact]
public void $Unit$_$Scenario$_$Expected$()
{
$END$
}
@dburriss
dburriss / FactResharper
Created June 28, 2017 05:40
An XUnit fact snippet for Resharper.
[Fact]
public void $Unit$_$Scenario$_$Expected$()
{
$END$
}
@dburriss
dburriss / appveyor.yml
Last active January 31, 2017 23:13
Pretzel AppVeyor build and deployment to blog
branches:
only:
- source
environment:
access_token:
secure: ABC123...
# replace the above with your secure token
install:
@dburriss
dburriss / pretzel.cake
Last active March 19, 2017 22:16
A Cake build script for building Pretzel static content
var target = Argument("target", "Default");
var configuration = Argument("Configuration", "Release");
var port = Argument("Port", "5001");
var installDirectory = "C:\\ProgramData\\chocolatey\\lib\\pretzel\\tools";
var pretzelExe = installDirectory + "\\Pretzel.exe";
public static void Replace(string file, string @this, string withThis)
{
var config = System.IO.File.ReadAllText(file, Encoding.UTF8);
@dburriss
dburriss / NoNullString.cs
Last active November 6, 2021 09:26
Code required to create a model binder that sets or empty or no strings to empty string during binding
//In Startup.cs file
services.AddMvc(config =>
config.ModelBinderProviders.Insert(0, new NoNullStringModelBinderProvider())
);
//model binder provider
public class NoNullStringModelBinderProvider : IModelBinderProvider
{
public IModelBinder GetBinder(ModelBinderProviderContext context)
{
@dburriss
dburriss / kuduSiteUpload.ps1
Last active September 17, 2015 06:19 — forked from davideicardi/kuduSiteUpload.ps1
Upload a local directory to an Azure Website using kudu and powershell
Param(
[Parameter(Mandatory = $true)]
[string]$websiteName,
[Parameter(Mandatory = $true)]
[string]$sourceDir,
[string]$destinationPath = "/site/wwwroot"
)
# Usage: .\kuduSiteUpload.ps1 -websiteName mySite -sourceDir C:\Temp\mydir