This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[InterpolatedStringHandler] | |
public ref struct LogInterpolatedStringHandler | |
{ | |
private int index = 0; | |
public readonly StringBuilder _builder = new StringBuilder(); | |
public readonly (string name,object)[] Parameters; | |
public LogInterpolatedStringHandler(int literalLength, int formattedCount) | |
{ | |
Parameters = new (string, object)[formattedCount]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A minor modification of the script here https://www.mehmetseckin.com/posts/clean-up-git-branches-that-do-not-exist-on-origin/ | |
function Remove-DeletedGitBranches | |
{ | |
$null = (git fetch --all --prune); | |
$branches = git branch -vv | Select-String -Pattern ": gone]" | ForEach-Object { $_.toString().Split(" ")[2] }; | |
if ($branches.Count -gt 0) | |
{ | |
Write-Host "Found the following orphan branches: " -ForegroundColor Green |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Define other methods and classes here | |
public class Rewriter : CSharpSyntaxRewriter | |
{ | |
private string LastGroup = null; | |
private int? Index = null; | |
public override SyntaxNode VisitPropertyDeclaration(PropertyDeclarationSyntax node) | |
{ | |
var display = node.AttributeLists.SelectMany(x => x.Attributes.Where(y => y.Name.ToString() == "Display")).FirstOrDefault(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Very opinionated Source generator that tries to match a class to test and generates a InitSubject method | |
/// that can return the class being tested. If there are parameters those are initialized with mocking setup | |
/// (using NSubstitute) and injected. The parameters will be exposed as fields | |
/// </summary> | |
[Generator] | |
public class UnitTestEnricher : ISourceGenerator | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-Clipboard | Out-File -FilePath thesql.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2016-09-30T20:18:17.349Z"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module webadministration | |
$managedRuntime = "v4.0" | |
$Name = "Madplan" | |
# This is of cause a dependency on Powershell version 3.0 | |
$webPath = join-path $PSScriptRoot $Name | |
Write-Host $webPath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Cd-OneDrive() | |
{ | |
$userPath = Join-Path $env:UserProfile 'onedrive' | |
Write-Warning "Testing ->$userPath" | |
if (Test-Path -Path $userPath) | |
{ | |
cd $userPath | |
} | |
$userPath = Join-Path $env:UserProfile 'skydrive' |