Skip to content

Instantly share code, notes, and snippets.

View jcansdale's full-sized avatar

Jamie Cansdale jcansdale

View GitHub Profile
@jcansdale
jcansdale / gist:7fa50ede36d712b54b77c746e3f54bdf
Created July 22, 2016 11:07
Some utility methods for poking around .NET Core.
namespace Utilities
{
using System;
using System.Collections;
using System.Collections.Generic;
public static class NetCoreUtilities
{
public static string[] GetTrustedPlatformAssemblies()
{
static string getNamePreserveCase(EnvDTE.Document doc)
{
var name = doc.Name;
var fullName = doc.ProjectItem.FileNames[0];
name = fullName.Substring(fullName.Length - name.Length, name.Length);
return name;
}
@jcansdale
jcansdale / details.md
Last active August 12, 2016 08:55
Using `<details>` in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 <summary>Summary Goes Here</summary>
 ...this is hidden, collapsable content...
@jcansdale
jcansdale / GetAssemblies.cs
Last active August 14, 2016 21:57
.NET Core implementation of AppDomain.GetAssemblies()
public Assembly[] GetAssemblies()
{
var assemblies = new List<Assembly>();
foreach(ProcessModule module in Process.GetCurrentProcess().Modules)
{
try
{
var assemblyName = AssemblyLoadContext.GetAssemblyName(module.FileName);
var assembly = Assembly.Load(assemblyName);
assemblies.Add(assembly);
@jcansdale
jcansdale / gist:2af856d3a6451d67d734fffe4a65e830
Created September 9, 2016 13:53
Compile vs manual evaluation
```ini
Host Process Environment Information:
BenchmarkDotNet.Core=v0.9.9.0
OS=Microsoft Windows NT 6.2.9200.0
Processor=Intel(R) Core(TM) i7-4500U CPU 1.80GHz, ProcessorCount=4
Frequency=2338341 ticks, Resolution=427.6536 ns, Timer=TSC
CLR=MS.NET 4.0.30319.42000, Arch=32-bit ?
GC=Concurrent Workstation
JitModules=clrjit-v4.6.1586.0
@jcansdale
jcansdale / ExpressionInvokerBenchmark.md
Created September 9, 2016 13:54
Compile vs manual evaluation
Host Process Environment Information:
BenchmarkDotNet.Core=v0.9.9.0
OS=Microsoft Windows NT 6.2.9200.0
Processor=Intel(R) Core(TM) i7-4500U CPU 1.80GHz, ProcessorCount=4
Frequency=2338341 ticks, Resolution=427.6536 ns, Timer=TSC
CLR=MS.NET 4.0.30319.42000, Arch=32-bit ?
GC=Concurrent Workstation
JitModules=clrjit-v4.6.1586.0
@jcansdale
jcansdale / TestDrivenBenchmarks.cs
Created September 15, 2016 14:34
How to quickly preview benchmarks using TestDriven.Net.
// Add the `BenchmarkDotNet.TestDriven` NuGet package.
using System;
using System.Reflection;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.TestDriven;
// Let TestDriven.Net know how to run benchmarks.
[assembly: BenchmarkTestRunner(typeof(FastAndDirtyConfig))]
@jcansdale
jcansdale / NuGet.config
Created September 15, 2016 15:10
How to setup a `LocalPackages` folder for NuGet
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="LocalPackages" value="./LocalPackages" />
</packageSources>
<activePackageSource>
<!-- this tells that all of them are active -->
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>
@jcansdale
jcansdale / GitHub.InlineReviews.txt
Created April 24, 2017 14:40
What MEF classes consume GitHub.InlineReviews?
>github mef-FindSatisfyingExports GitHub.InlineReviews
Microsoft.VisualStudio.TMLanguage.AssetFinder
.Taggers = GitHub.InlineReviews.Tags.ReviewTaggerProvider
Microsoft.VisualStudio.Language.Intellisense.Implementation.PeekBroker
.UnOrderedPeekableItemSourceProviderExports = GitHub.InlineReviews.Peek.ReviewPeekableItemSourceProvider
Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregatorFactoryService
.BufferTaggerProviders = GitHub.InlineReviews.Tags.ReviewTaggerProvider
Microsoft.VisualStudio.Text.Editor.Implementation.GlyphMarginProvider
.GlyphMouseProcessorProviders = GitHub.InlineReviews.Tags.ReviewGlyphFactoryProvider
------ Test started: Assembly: WpfApp2.exe ------
Microsoft.VisualStudio.PlatformUI.MainWindow: MainSite, Children = 1, VisibleChildren = 1, DockedWidth = 200, DockedHeight = 200
Microsoft.VisualStudio.PlatformUI.Shell.Controls.WindowContentPresenter
Microsoft.VisualStudio.PlatformUI.MainWindowTitleBar
Microsoft.VisualStudio.PlatformUI.Shell.Controls.SystemMenu
Microsoft.VisualStudio.PlatformUI.Shell.Controls.WindowTitleBarButton
Microsoft.VisualStudio.PlatformUI.Shell.Controls.WindowTitleBarButton
Microsoft.VisualStudio.PlatformUI.Shell.Controls.WindowTitleBarButton
Microsoft.VisualStudio.PlatformUI.FrameControlContainer Items.Count:3