Skip to content

Instantly share code, notes, and snippets.

@ninmonkey
ninmonkey / Kinda Fancy VsCode Snippets.json
Created June 26, 2024 23:05
Kinda Fancy VsCode Snippets.json 2024-06
/*
I use these a lot to fix paths in files for github, like markdown links.
*/
{
"🐒🦍path: Wraps selected text with a file uri": {
"prefix": "insertFileUrl fileUrl",
"description": "🦍 wraps selected text with a file url like: <file:///foo.txt> . Note: Currently wraps, does not convert spaces",
"body": [
"<file:///${TM_SELECTED_TEXT:foobar.txt}>$0"
]
@ninmonkey
ninmonkey / readme.md
Last active June 24, 2024 20:02
test css alignments 2024-06

About

Testing alignments embedded in github

<style type="text/css">div { border: 2px solid blue } </style>
@ninmonkey
ninmonkey / settings.jsonc
Last active June 20, 2024 22:02
This enables json schemas for Power BI report using the new PBIR extension
{
/*
for TMDL syntax highlighting in VS Code: https://marketplace.visualstudio.com/items?itemName=analysis-services.TMDL
About PBI JSON Schemas:
- https://github.com/microsoft/powerbi-desktop-samples/tree/main/item-schemas
More links related to PBIR or schemas:
@ninmonkey
ninmonkey / Which Verbs to Use Question.ps1
Created June 7, 2024 19:27
Which Verbs to Use Question.ps1
filter MdFormat-EscapePath {
<#
.SYNOPSIS
make safe markdown style links. convert paths to work as urls and console clickable urls like: <file:///{0}>'
.example
> 'dir\some Item.md' | MdFormat-EscapePath
dir/some%20Item.md
#>
$_ -replace ' ', '%20' -replace '\\', '/'
@ninmonkey
ninmonkey / Calc Relative Dates in Pwsh.ps1
Created May 31, 2024 02:52
Calc Relative Dates in Pwsh, using file modified dates
function CalcRelativeDays {
param(
[datetime]$BaseDate,
[datetime]$InputDate,
# default returns totalDays, this returns the raw [TimeSpan]
[switch]$PassThru
)
if($PassThru){
return ($InputDate - $BaseDate)
}
@ninmonkey
ninmonkey / Auto Attributes Type Def Test - System.Json.Text.ps1
Created May 29, 2024 20:01
(wip sketch) Test: Auto add Attributes to Type Def for - System.Json.Text
#Requires -Version 7
using namespace System.Collections.Generic
using namespace System.Text
using namespace System.Text.Json
using namespace System.Text.Json.Serialization
$assembly = Add-type -AssemblyName System.Text.Json -PassThru -ea 'stop'
function AutoJson {
<#
@ninmonkey
ninmonkey / Power Query Gh-Copilot example.md
Last active May 26, 2024 18:31
Example of Copilot Generating code using my library in Power Query.md

snippet of my lib

The rest of the code is here: Write.Html.pq

// aliases
Write.Format  = String.Write.Format,
Write.Element = Write.Html.Element,
Write.Key     = Write.Html.KeyValue,
Tag           = Write.Html.Element,
@ninmonkey
ninmonkey / Select-Some-Or-One.ps1
Last active May 26, 2024 02:16
PowerShell Selecting First, Last, One, Some, script.ps1
using namespace System.Collections.Generic
Import-module Pansies
function Dotfiles.Select-Some {
<#
.SYNOPSIS
select 1 item, 5, or a specific count.
.NOTES
- [ ] future: rewrite using steppable pipeline for an earlier exit
.EXAMPLE
@ninmonkey
ninmonkey / settings.json
Created May 23, 2024 23:36
VsCode Settings - Default using Pwsh profile settings.json
{
// settings related to pwsh terminal
"powershell.enableProfileLoading": true,
"terminal.integrated.defaultProfile.windows": "Pwsh🐒", // "Pwsh🐒",
// The terminal profile to use for automation-related terminal usage like tasks and debug. This setting will currently be ignored if `terminal.integrated.automationShell.windows` (now deprecated) is set.
"terminal.integrated.automationProfile.windows": {
"args": [
"-NoLogo"
],