Skip to content

Instantly share code, notes, and snippets.

@ninmonkey
ninmonkey / format-predent-test.md
Last active July 1, 2023 19:53
format-predent-test.md
@ninmonkey
ninmonkey / comparing original.md
Last active June 7, 2023 00:44
Refactoring ArrayList with as a Modern Array Example

I call it modern, but it fully works on PS5.1 without changes!

tip: abbreviated version using namespaces

In the examples below, if you add a using namespace statement, you can remove Systems.Collections.Generic tip: System is always included, so you can omit that prefix anywhere as well.

using namespace system.collections.generic
[List[Object]]$users = @()
@ninmonkey
ninmonkey / generated_export.cs
Last active May 12, 2023 06:10
Generate-CodepointWidthsFromUCD.ps1 a tool from /Terminal
// Generated by Generate-CodepointWidthsFromUCD.ps1 -Pack:True -Full: -NoOverrides:False
// on 2023-05-12 05:07:14Z from Unicode 15.0.0.
// 321149 (0x4E67D) codepoints covered.
// 240 (0xF0) codepoints overridden.
// Override path: G:\my🍴\microsoft🧑\terminal\src\types\unicode_width_overrides.xml
static constexpr std::array<UnicodeRange, 297> s_wideAndAmbiguousTable{
UnicodeRange{ 0xa1, 0xa1, 1 },
UnicodeRange{ 0xa4, 0xa4, 1 },
UnicodeRange{ 0xa7, 0xa8, 1 },
UnicodeRange{ 0xaa, 0xaa, 1 },
@ninmonkey
ninmonkey / Comparing ParameterBinding output on Pwsh vs WinPS.md
Last active April 29, 2023 15:59
Comparing ParameterBinding output on Pwsh vs WinPS

update

Difference may have been an implicit import, aliasing to the other write-host . Compare with:

Trace-Command -PSHost  -Name ParameterBinding -Expression {  Microsoft.PowerShell.Utility\Write-Host $($checkBox.Text) is checked } -Verbose
Trace-Command -PSHost  -Name ParameterBinding -Expression {  pansies\Write-Host $($checkBox.Text) is checked } -Verbose
Trace-Command -PSHost  -Name ParameterBinding -Expression {  Pipeworks\Write-Host $($checkBox.Text) is checked } -Verbose
@ninmonkey
ninmonkey / ActualUsage-GhRepoSummary.ps1
Last active April 6, 2023 03:42
Write-GhRepoSummary.ps.ps1
Import-Module PipeScript -PassThru | out-null
Export-Pipescript -InputPath '*.ps.md'
# this runs powershell in the markdown file ./GhRepoSummary.ps.md
# outputting a raw text markdown file
@ninmonkey
ninmonkey / Powershell Settings - vscode.md
Last active March 23, 2023 03:47
VS Code Settings for Powershell 2023.03

Default settings in VS Code are dynamic. They are generated based on your extensions's metadata. That means they are up to date. I have some tips for discovering new settings in Vs Code through Default settings (ninmonkeys.com)

Another extension that helps is Better Align

The main settings:

{   "powershell.codeFormatting.autoCorrectAliases": true,
    "powershell.codeFormatting.useConstantStrings": true,
    "powershell.codeFormatting.useCorrectCasing": true,
 "powershell.codeFormatting.alignPropertyValuePairs": true,
@ninmonkey
ninmonkey / TOC : Tabular Editor 2 and 3 : Custom c# Scriptas and bestPracticeAnalyzer.2023.04.md
Last active March 20, 2023 02:52
TOC : Tabular Editor 2/3 : Custom c# Scriptas and bestPracticeAnalyzer

BestPracticeAnalyzer and CSharp using Tabular models (generated on: 2023-03)

Note, some things tagged as TabularEditor2 vs 3 have a decent level of overlap, that it's worth checking out the other

@ninmonkey
ninmonkey / Vs Code Config Samples.md
Created March 10, 2023 21:23
Misc VS Code Config Samples.md

2023-03-10 : Saving and Restoring Window Sessions

I almost always have multiple windows up. My config will

if I use the file -> exit menu,

  • all windows close
  • It quits without prompting for unsaved files
  • the next time I open it all windows are restored including never-saved-files

If I click X on a window to close it