Skip to content

Instantly share code, notes, and snippets.

View bradwilson's full-sized avatar
🤘
All metal, all the time!

Brad Wilson bradwilson

🤘
All metal, all the time!
View GitHub Profile
@bradwilson
bradwilson / vs2017.ps1
Last active January 23, 2018 19:05
VS 2017 PowerShell script; if you need invoke-cmdscript, it's here: https://gist.github.com/bradwilson/3fca203370d54304eff1cce21ffc32aa
param(
[string]$edition,
[switch]$noWeb = $false
)
# Try and find a version of Visual Studio in the expected location, since the VS150COMNTOOLS environment variable isn't there any more
$basePath = join-path (join-path ${env:ProgramFiles(x86)} "Microsoft Visual Studio") "2017"
if ((test-path $basePath) -eq $false) {
write-warning "Visual Studio 2017 is not installed."
@bradwilson
bradwilson / invoke-cmdscript.ps1
Created March 7, 2017 04:19
Invoke a CMD/BAT script and scrape the environment variable changes
param(
[Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)][string] $Script,
[Parameter(Position=1, Mandatory=$false)][string] $Parameters
)
$tempFile = [IO.Path]::GetTempFileName()
cmd /c " `"$script`" $parameters && set > `"$tempFile`" "
Get-Content $tempFile | %{
@bradwilson
bradwilson / UnitTest1.cs
Last active March 2, 2017 01:46
Multi-targetted unit test project
using System;
using Xunit;
public class UnitTest1
{
[Fact]
public void Passing()
{
Assert.True(true);
}

Keybase proof

I hereby claim:

  • I am bradwilson on github.
  • I am bradwilson72 (https://keybase.io/bradwilson72) on keybase.
  • I have a public key ASAW1h5cq8YOKoz2uSp0bB8qje8scVkjD5riQgNEnn614Qo

To claim this, I am signing this object:

@bradwilson
bradwilson / 1.0.0-rc3-004530.csproj
Last active February 11, 2017 00:41
Blank project file for xUnit.net for MSBuild v15 (as generated by `dotnet new`)
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170106-08" />
<PackageReference Include="xunit" Version="2.2.0-beta5-build3474" />
@bradwilson
bradwilson / gist:25dad9dabd340684ff3500df09fd8fb3
Created August 22, 2016 15:55
Show me the ambiguous name, damn it!
System.Reflection.AmbiguousMatchException : Ambiguous match found.
Stack Trace:
at System.RuntimeType.GetMethodImpl(String name, BindingFlags bindingAttr, Binder binder, CallingConventions callConv, Type[] types, ParameterModifier[] modifiers)
at System.Type.GetMethod(String name)
@bradwilson
bradwilson / _readme.md
Last active July 3, 2019 15:17
bash-git prompt overrides

The OS X version does not require any custom fonts, because it uses the built-in emoji and symbol support in OS X.

The Linux version requires that you install Font Awesome.

@bradwilson
bradwilson / colors.ps1
Last active December 7, 2017 12:30
Custom Posh-Git prompt
# Background colors
$GitPromptSettings.AfterBackgroundColor = "DarkBlue"
$GitPromptSettings.AfterStashBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.BeforeBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.BeforeIndexBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.BeforeStashBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.BranchAheadStatusBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.BranchBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.BranchBehindAndAheadStatusBackgroundColor = $GitPromptSettings.AfterBackgroundColor
$GitPromptSettings.BranchBehindStatusBackgroundColor = $GitPromptSettings.AfterBackgroundColor
@bradwilson
bradwilson / issues.md
Created August 4, 2015 01:27
Dependency selection logic issues in NuGet v3

Look at these lines in this NUSPEC file:

https://github.com/xunit/xunit/blob/b1cbc40158cc53be5b9150bcdeb2e1cae40db5c9/src/xunit.extensibility.execution.nuspec#L24-L44

They were added because we observed some very unusal behavior. Specifically, note that the libraries are all platform specific (other than portable-win81+wpa81). Without the highlighted lines, this is the observable behavior when referencing this NuGet package:

  • It would link against the platform-specific library (e.g., lib\net45\xunit.execution.desktop.dll)
  • It would pull the dependency list from "dotnet", some of which are clearly not net45 compatible (e.g., System.Runtime 4.0.20)

We originally had a TF-less group, which we assumed would be used by anybody who wasn't "dotnet" or "dnx46":

@bradwilson
bradwilson / colors.vssettings
Created August 1, 2015 17:26
New dark colors for VS 2015
<UserSettings>
<ApplicationIdentity version="14.0" />
<ToolsOptions>
<ToolsOptionsCategory name="Environment" RegisteredName="Environment" />
</ToolsOptions>
<Category name="Environment_Group" RegisteredName="Environment_Group">
<Category name="Environment_FontsAndColors" Category="{1EDA5DD4-927A-43a7-810E-7FD247D0DA1D}" Package="{DA9FB551-C724-11d0-AE1F-00A0C90FFFC3}" RegisteredName="Environment_FontsAndColors" PackageName="Visual Studio Environment Package">
<PropertyValue name="Version">2</PropertyValue>
<FontsAndColors Version="2.0">
<Theme Id="{1DED0138-47CE-435E-84EF-9EC1F439B749}" />