Skip to content

Instantly share code, notes, and snippets.

@ninmonkey
ninmonkey / Locations of Known Log Files.2024.md
Last active July 21, 2024 18:50
Log Locations for several apps, in one place. Started: 2024-07
@ninmonkey
ninmonkey / AsyncAwait-part1.js
Last active July 19, 2024 19:35
Executing Before Async Await finishes
function resolveAfterDelay(x, ms) {
// async invoke after x milliseconds
return new Promise((resolve) => {
setTimeout(() => {
resolve(x);
}, ms ?? 200 );
});
}
async function f1() {
@ninmonkey
ninmonkey / Github extra Markdown syntax.md
Created July 13, 2024 23:12
Show some of the extra gitub syntaxes

native github render includes the sections

> [!IMPORTANT]

Important

foo bar

@ninmonkey
ninmonkey / SillySyncAsAsyncExample-2.js
Last active July 11, 2024 18:04
Silly Excessive Example of calling Synchronous function as async in javascript
function fnSync ( params ) {
// some Sync function that returns something
console.log( `🟠 fnSync => exit: ${ params }` )
return `[ SyncResult: ${ params } ]` // renders nicer in the log than
// return { syncResult: 'didStuff', params: params }
}
function fnAsync ( params ) {
// now it's async
return new Promise( ( resolve ) => {
console.log( `🟢 fnAsync => enter: ${ params }` )
# Here's tiny clipboard sugar for a profile
# context: there was a thread about creating a custom clipboard uri, and clipboard cmdlets
# <https://discord.com/channels/180528040881815552/447476117629304853/1260981998479081562>
Import-Module Pansies
# It's nice to get a confirmation that your clip was saved
$PSDefaultParameterValues['Set-ClipBoard:PassThru'] = $true
Set-alias 'cl' 'Set-ClipBoard' # 'sc' already exists
Set-Alias 'gcl' 'Get-Clipboard'
@ninmonkey
ninmonkey / Result Summaries using Arrays and Export-Excel.ps1
Last active June 28, 2024 16:46
Quick example of saving results to arrays when implicit output was getting complicated
using namespace System.Collections.Generic
# Say you want one table that has all results, with fixed columns
[list[Object]]$Summary = @()
# and a second array that's just errors with extra info
[list[Object]]$ErrorSummary = @()
foreach( $user in $UserCsv ) {
$result = [pscustomobject]@{
@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 / VsCode Config for Power BI TMDL - settings.jsonc
Last active July 14, 2024 19:09
This enables json schemas for Power BI report using the new PBIR extension
{
/*
Power BI:
for TMDL syntax highlighting in VS Code: https://marketplace.visualstudio.com/items?itemName=analysis-services.TMDL
where to find schemas
- [1] https://github.com/microsoft/powerbi-desktop-samples/tree/main/item-schemas
- [2] https://github.com/microsoft/powerbi-desktop-samples/tree/main/Report%20Theme%20JSON%20Schema
More links related to PBIR/PBIP/tmdl and 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 '\\', '/'