Skip to content

Instantly share code, notes, and snippets.

View jkavanagh58's full-sized avatar

John J Kavanagh jkavanagh58

View GitHub Profile
Extension Name Priority Comments
PowerShell 1 Goes without saying
PrintCode 3 If you share code via email and any copy/paste
BlackBoard 3 If you like dark themes I prefer this one
Share Code 2 Much betterr to share and post code
Bracket Pari Colorizer 2 Very helpful for script editing and debugging
Visual Studio Team Services
Function Remove-CodeConfig {
<#
.NOTES
08.12.2018 JJK: TODO: Add the Whatif component of ShouldSupportProcess
#>
[CmdletBinding(SupportsShouldProcess, ConfirmImpact='Medium')]
Param ()
# Check for existing config and data
If (Test-Path $env:APPDATA\Code -ErrorAction SilentlyContinue){
# Remove from AppData
#Requires -Modules ImportExcel
$xlsxPath = "C:\Users\vndtekjxk\OneDrive - Wegmans Food Markets, Inc\Documents\SRM"
$xlsxName = "SRM1.xlsx"
$xlsxFile = Join-Path $xlsxPath -ChildPath $xlsxName
If (Test-Path $xlsxFile) {
$dataSet = Import-Excel -Path $xlsxFile -WorksheetName Sheet1 -DataOnly
$dataSet | Select-Object -Property Group -Unique | sort-object -Property Group
}
@jkavanagh58
jkavanagh58 / powershell.json
Last active September 10, 2018 15:03
Customized PowerShell snippet file for Visual Studio Code
{
"PS Custom Object": {
"prefix": "customobj",
"body": [
"$$obj = [pscustomobject]@{",
"\t$FieldName = $FieldValue\r",
"}"
],
"description": "Skeleton for adding a PowerShell Custom Object"
},
Find-Module -Tag PSEdtion_Desktop, PSEdition_Code
Find-Module -Tag PSEdtion_Desktop, PSEdition_Code
<#
.SYNOPSIS
Clean up PowerShell Installed Modules
.DESCRIPTION
Examine installed modules and determine versions that can be removed from installation folder.
.PARAMETER modInstalled
Collection of currently installed modules installed via PowerShellGet
.EXAMPLE
PS> ./uninstall-module-history.ps1
Example of how to use this script
@jkavanagh58
jkavanagh58 / Function CBH
Created October 1, 2019 15:15
VSCode Snippet - PowerShell CBH for Functions
"Function CBH": {
"prefix": "PSFuncHelp",
"body": [
"<#\r",
".SYNOPSIS\r",
"\tShort description",
".DESCRIPTION\r",
"\tLong description",
".PARAMETER Path\r",
"\tSpecifies a path to one or more locations.",
@jkavanagh58
jkavanagh58 / collarray snippet
Last active October 31, 2019 14:05
VSCode PowerShell Snippet for using System.Collections.ArrayList to create an Array
"Array List using Collection": {
"prefix": "collarray",
"body": [
"# Create New Array\r",
"$${1:arrayName} = [System.Collections.ArrayList]@()\r",
"# Add items to array\r",
"$${1}.Add(\"${2:ItemValue}\") | Out-Null"
],
"description": "Form Array using .Net Collection"
}
@jkavanagh58
jkavanagh58 / powershell.json
Created November 12, 2019 14:18
Current VSCode PowerShell Snippet file
{
"Day of Week Validated Parameter": {
"prefix": "DOWParam",
"body": [
"[Parameter(Mandatory = $$true,\r",
"\tValueFromPipeline = $$true,\r",
"\tHelpMessage = \"${1:Enter Help Message Here}\")]\r",
"[ValidateSet('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday')]\r",
"[System.String]$${2:parametername}\r"
],