CLICK ME
yes, even hidden code blocks!
print("hello world!")| [user] | |
| name = Brad Wilson | |
| email = dotnetguy@gmail.com | |
| [alias] | |
| a = add -A | |
| abort = rebase --abort | |
| amend = commit --amend -C HEAD | |
| bl = blame -w -M -C | |
| br = branch | |
| cat = cat-file -t |
| // And this program can be writen in C# after all if you use an extension method! | |
| // (And the codegen is exactly as the optimal hand-written IL below.) | |
| // | |
| // Thanks to Vladimir Sadov on the compiler team for teaching me about it! | |
| static class Program | |
| { | |
| static void Main() | |
| { | |
| var f = new Func<string>("World".StaticMethod); |
| // Convert from normal to web-safe, strip trailing "="s | |
| function webSafe64(base64) { | |
| return base64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, ''); | |
| } | |
| // Convert from web-safe to normal, add trailing "="s | |
| function normal64(base64) { | |
| return base64.replace(/\-/g, '+').replace(/_/g, '/') + '=='.substring(0, (3*base64.length)%4); | |
| } |
| open Microsoft.CodeAnalysis | |
| open Microsoft.CodeAnalysis.CSharp | |
| open Microsoft.CodeAnalysis.CSharp.Syntax | |
| open Microsoft.CodeAnalysis.MSBuild | |
| open Microsoft.CodeAnalysis.Formatting | |
| open System.IO | |
| module FluentRoslynLite = | |
| let (!!) t = Async.AwaitTask t | |
| let emptyFile = SyntaxFactory.CompilationUnit() |
| 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)) |
| ### Customize Prompt for Visual Studio Developer PowerShell | |
| # Get the current prompt | |
| $defaultPrompt = (Get-Item function:prompt).ScriptBlock | |
| # Setup the custom prompt | |
| function prompt { | |
| $pr = if (Test-Path env:/VSINSTALLDIR) { "[VS $env:VisualStudioVersion]:" } | |
| else {''} | |
| Write-Host $pr -NoNewline -ForegroundColor DarkMagenta |
| public static class ReflectionExtensions | |
| { | |
| /// <summary> | |
| /// Gets a value indicating whether property has init accessor declared. | |
| /// </summary> | |
| /// <param name="propertyInfo"></param> | |
| /// <returns>Returns <c>true</c> if the property is declared as init-only; otherwise returns <c>false</c>.</returns> | |
| public static bool IsInitOnly(this PropertyInfo propertyInfo) | |
| { | |
| if (propertyInfo == null) |
It's not obvious how to produce an intersection of two itemgroups in MSBuild. There's this brainteaser solution based on tricky metadata behaviour, but it only works inside a <target> due to it's use of metadata.
There is another way. Algebra tells us that A ∩ B = A ∖ (A∖B): intersection of A and B is A excluding (A excluding B). This can be expressed in MSBuild as:
<ItemGroup>
<A Include="1" />
<A Include="2" />
<A Include="3" />