Skip to content

Instantly share code, notes, and snippets.

View jcansdale's full-sized avatar

Jamie Cansdale jcansdale

View GitHub Profile
@jcansdale
jcansdale / ExpressionUtilities.cs
Created September 9, 2016 17:31
Helper methods to quickly evaluate simple expressions
using System;
using System.Reflection;
using System.Collections.Generic;
using System.Linq.Expressions;
public static class ExpressionUtilities
{
public static object GetValue(Expression expression)
{
return getValue(expression, true);
@jcansdale
jcansdale / gist:ccbd48644efbcbd6b3fb7242dc759dea
Created August 1, 2017 10:06
ITeamExplorerSection exports from Visual Studio 2015
Microsoft.VisualStudio.TeamFoundation.VersionControl.PendingChanges.ChangesToExcludeSectionVS (C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\3y3blfwb.uew\Microsoft.VisualStudio.TeamFoundation.VersionControl.dll)
ParentPageId: FD273AA7-0538-474B-954F-2327F91CEF5E
ExportTypeIdentity: Microsoft.TeamFoundation.Controls.ITeamExplorerSection
Id: 7B018EAE-3E33-4F04-B5CA-DA8358396581
PlacementParentPageId: 22841D4D-257A-4421-ADF5-44F5ED556EA3
PlacementPriority: System.Int32[]
Priority: 50
ContractType: Microsoft.TeamFoundation.Controls.ITeamExplorerSection
ContractName:
Microsoft.VisualStudio.TeamFoundation.VersionControl.PendingChanges.ChangesToIncludeSectionVS (C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\3y3blfwb.uew\Microsoft.VisualStudio.TeamFoundation.VersionControl.dll)

npm

  • Packages are published to the OWNER scope
  • Unscoped packages can't be published
@OWNER:registry=https://npm.pkg.github.com
@jcansdale
jcansdale / gradle.md
Last active March 17, 2020 18:37
Gradle experiments

This doesn't work so well:

$ docker run -it --entrypoint bash gradle

So I'm using:

$ docker run -it --entrypoint bash frekele/gradle
@jcansdale
jcansdale / challenge.md
Last active January 24, 2020 19:56
Unit testing challenge

I'm looking for the cleanest way to make the test below pass.

The rules are:

  1. It must be a unit test (so don't touch the file system).
  2. The public signature for CodeUnderTest must not be changed. can be extended not reduced
  3. You're allowed to use DI/your favorite mocking framework.
  4. You can only add code where you see /**/.
@jcansdale
jcansdale / go.js
Last active January 14, 2020 22:36
JavaScript playground
function gooo()
{
console.log('hmmmmmmmmmmmmmmmm');
}
@jcansdale
jcansdale / git-credential-fill.md
Last active December 8, 2019 23:23
Retrieve a GitHub authentication token

Try entering the following in Git Bash:

$ git credential fill
protocol=https
host=github.com

(note the blank line)

@jcansdale
jcansdale / HelloGists.csproj
Created October 9, 2019 08:41
Hello, Gists!
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
</Project>
@jcansdale
jcansdale / DumpProjects.cs
Created February 6, 2019 14:55
Enumerate projects in a solution
using System;
using System.Collections.Generic;
using EnvDTE;
public class Tests
{
[STAThread]
static IList<string> DumpProjects(DTE dte)
{
var projects = new List<string>();
public string FindOutputFilePath(IVsTextManager2 textManager, IVsEditorAdaptersFactoryService adapters)
{
if(textManager.GetActiveView2(1, null, (uint)_VIEWFRAMETYPE.vftCodeWindow, out IVsTextView activeView) == VSConstants.S_OK)
{
var textView = adapters.GetWpfTextView(activeView);
var doc = textView.TextBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges();
return doc.Project.OutputFilePath;
}
return null;