Skip to content

Instantly share code, notes, and snippets.

View DanielMPries's full-sized avatar

Dan Pries DanielMPries

  • Buffalo, NY
View GitHub Profile
@DanielMPries
DanielMPries / WithObjectExtenension.cs
Last active October 22, 2017 00:55
Demonstrates the With keyword implementation similar to VB.NET using a generic extension method
using System;
namespace Sandbox {
class Program {
static void Main(string[] args) {
var someLongNamedVariableName = new Person();
// Notice that the parent object is marked with two underscores "__"
// and the child with a single underscore "_". This is because the
// double underscore created in the outer anonymous Action lamda
@DanielMPries
DanielMPries / zip-folders.ps1
Created October 3, 2018 19:11
Compress all of the files in a given path
# This is the old way, use Compress-Archive
Add-Type -assembly "system.io.compression.filesystem"
$source = Get-ChildItem -Path "c:\stuff" -Directory
Write-Host "$($source.length) files found"
Foreach ($s in $source) {
Write-Host "Writing $($s.name).zip..."
$destination = Join-path -path "C:\stuff" -ChildPath "$($s.name).zip"
If(Test-path $destination) {
Remove-item $destination
}
@DanielMPries
DanielMPries / .editorconfig
Created December 27, 2018 03:04
Personal C# .editorconfig
# http://EditorConfig.org
###############################
# Common Settings #
###############################
# This file is the top-most EditorConfig file
root = true
# All Files
@DanielMPries
DanielMPries / SpecflowDependencies.ps1
Created December 11, 2019 01:34
Specflow packages
dotnet add package Specflow
dotnet add package SpecFlow.MsTest
dotnet add package SpecFlow.Tools.MsBuild.Generation
dotnet add package FluentAssertions
@DanielMPries
DanielMPries / CoverletDependencies.ps1
Last active December 11, 2019 02:16
Coverlet settings
# Add coverlet to the test project(s)
dotnet add package coverlet.msbuild
# or for VSTest
# dotnet add package coverlet.collector
# Add the coverlet global cli tool
dotnet tool install --global coverlet.console
# coverage gutters vscode extension
ext install ryanluker.vscode-coverage-gutters
@DanielMPries
DanielMPries / XmlDocMd.ps1
Created December 11, 2019 02:11
Tool and task for Xml Doc Markdown
dotnet tool install xmldocmd -g
@DanielMPries
DanielMPries / .editorconfig
Last active December 11, 2019 02:14
dotnet-format tool and task
root = true;
[*]
indent_style = space
trim_trailing_whitespace = true
end_of_line = lf
# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
(New-Object System.DirectoryServices.DirectorySearcher("(&(objectCategory=User)(samAccountName=$($env:userna
me)))")).FindOne().GetDirectoryEntry().memberOf
@DanielMPries
DanielMPries / .bash_aliases
Created December 26, 2019 16:06
Allows for dotnet_update_packages command
function read_solution() {
echo "Parsing solution $1"
while IFS='' read -r line || [[ -n "$line" ]]; do
if [[ $line =~ \"([^\"]*.csproj)\" ]]; then
project="${BASH_REMATCH[1]}"
read_project "$(echo "$project"|tr '\\' '/')"
fi
done < "$1"