Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Cazzulino kzu

View GitHub Profile
@kzu
kzu / report.ps1
Last active Sep 24, 2018
Cross-platform GitHub status reporting powershell script for VSTS
View report.ps1
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$statusUrl = '$(GitHub.StatusUrl)'
$token = '$(GitHub.Token)'
if ($env:FIXEDSOURCEVERSION -eq $true) { return; }
# When the commit that triggered the build/release is a PR merge commit,
# this task will adjust the Build.SourceVersion to the original commit, not the
# merge commit
@kzu
kzu / AutoFix.feature
Created Sep 15, 2018
Automatically applying Roslyn code fixes during build
View AutoFix.feature
Feature: AutoFix
Applies code fixes during build
Scenario: Can apply StyleCop code fix automatically
Given Foo.csproj =
"""
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<LangVersion>Latest</LangVersion>
<TargetFramework>netstandard2.0</TargetFramework>
View Microsoft.Powershell_profile.ps1
# Add to your profile so you can run `Cleanup-VS` from any PS prompt
Function Cleanup-VS
{
$script = (Split-Path -parent $PSCommandPath) + "\vscleanup.ps1"
&$script
}
@kzu
kzu / ObservableExtensions.cs
Created Feb 21, 2018
ObservableExtensions
View ObservableExtensions.cs
public static class ObservableExtensions
{
static readonly Action<Exception> rethrow = e => ExceptionDispatchInfo.Capture(e).Throw();
static readonly Action nop = () => { };
public static IDisposable Subscribe<T>(this IObservable<T> source, Action<T> onNext)
=> Subscribe(source, onNext, rethrow, nop);
public static IDisposable Subscribe<T>(this IObservable<T> source, Action<T> onNext, Action<Exception> onError)
=> Subscribe(source, onNext, onError, nop);
@kzu
kzu / home-end.ahk
Created Feb 2, 2018
Home/End AutoHotKey remap
View home-end.ahk
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#InstallKeybdHook
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
; NoTrayIcon
; OPTIONAL: For those who use Home/End more than PgUp/PgDown, this flips their use with the Fn key.
; If you want the buttons to function as they are, add a semicolon (;) to the beginning of each line below.
Home::PgUp
End::PgDn
PgUp::Home
@kzu
kzu / blob
Last active Jun 30, 2018
See code in GitHub blobs in full screen width with Stylebot
View blob
/*
url: github.com/*/*/blob/**
stylebot does not support comments, so, set the
url of the style (in Options) and remove this
whole comment
*/
.repository-with-sidebar .repository-content {
width: calc(100% - 50px);
View gist:0ba82ef5d0c1726fa5bed13444febedf
<VSDIR>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7@%(Dev.Identity).0)</VSDIR>
<VSDIR Condition="'$(VSDIR)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7@%(Dev.Identity).0)</VSDIR>
View ProjectCapabilities.txt
AllTargetOutputGroups => C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0\JavaScript\Microsoft.VisualStudio.JavaScript.Common.targets
AllTargetOutputGroups => C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.targets
AllTargetOutputGroups => C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\JavaScript\Microsoft.VisualStudio.WJProject.targets
AllTargetOutputGroups => C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\JavaScript\Microsoft.CodeSharing.JavaScript.targets
AllTargetOutputGroups => C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.DesignTime.targets
AllTargetOutputGroups => C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.targets
AllTargetOutputGroups => C:\Program Files (x86)\MSBuild\1
@kzu
kzu / vsmef.linq
Created Jul 8, 2016
VSMEF Components
View vsmef.linq
var xmlns = new XmlNamespaceManager(new NameTable());
xmlns.AddNamespace("vsx10", "http://schemas.microsoft.com/developer/vsx-schema/2010");
xmlns.AddNamespace("vsx11", "http://schemas.microsoft.com/developer/vsx-schema/2011");
var vsix = from file in Directory.EnumerateFiles(@"C:\Program Files (x86)\Microsoft Visual Studio 14.0", "extension.vsixmanifest", SearchOption.AllDirectories)
where File.ReadAllLines(file)[0].StartsWith("<")
select file;
var mef = vsix
.Select(x => XDocument.Load(x))
@kzu
kzu / FixupTemplateWizards
Created Mar 15, 2016
Fixup vstemplate wizard if they have a version in the assembly name, to match GitInfo.Vsix's VsixVersion
View FixupTemplateWizards
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<XmlNamespace>&lt;Namespace Prefix='vs' Uri='http://schemas.microsoft.com/developer/vstemplate/2005'/&gt;</XmlNamespace>
</PropertyGroup>
<Target Name="ExtractPublicKey"
Inputs="$(AssemblyOriginatorKeyFile)"
Outputs="$(IntermediateOutputPath)key.pub">
<Exec Command='"$(TargetFrameworkSDKToolsDirectory)sn.exe" -p "$(AssemblyOriginatorKeyFile)" "$(IntermediateOutputPath)key.pub"' />