Skip to content

Instantly share code, notes, and snippets.

@ninmonkey
ninmonkey / Some Custom VS Code Settings.md
Last active November 9, 2022 21:42
Some Custom VS Code Settings.md
@ninmonkey
ninmonkey / Using conditional variables in DAX.md
Last active September 29, 2022 20:44
Using conditional variables in DAX.md

In dax studio (or tabular) You can output multiple tables, for different stages of your test

Codepoints are fun

  • This converts numbers (codepoints) to text
  • PBI blocks some codepoints, so you need to transform them
  • It preserves control chars by replacing them with symbols
  • For example: tabs becomes
  • Both IFERROR were required, because some codepoints threw an exception. (Null u+0000 IIRC)
@ninmonkey
ninmonkey / Compare-StringSet.ps1
Created September 29, 2022 19:32
Compare-StringSet.ps1
using namespace System.Collections.Generic
function Compare-StringSet {
<#
.synopsis
quickly
.example
Compare-StringSet ('a'..'g') ('c'..'z')
Compare-StringSet ('a'..'g') ('A'..'E')
.example
@ninmonkey
ninmonkey / Handling Status Code Errors - Invoke-RestMethod.ps1
Last active September 29, 2022 20:20
Handling Status Code Errors - Invoke-RestMethod.ps1
function processAPICall {
$irmSplat = @{
Uri = @(
$script:IrmConfig.BaseUrl
'/api/v2/companies/{0}/employees/{1}' -f @(
$companyId
$employeeId
)
) -join ''
@ninmonkey
ninmonkey / Automatic Pwsh Objects from Regex Groups.md
Last active September 27, 2022 01:19
Automatic Objects from Regex Groups.md
Action Description
about Inkscape version, authors, license
action-list Print a list of actions and exit
clone Create a clone (a copy linked to the original) of selected object
clone-link Relink the selected clones to the object currently on the clipboard
clone-link-lpe Creates a new path, applies the Clone original LPE, and refers it to the selected path
clone-unlink Cut the selected clones' links to the originals, turning them into standalone objects
clone-unlink-recursively Unlink all clones in the selection, even if they are in groups.
com.inkscape.generate.generate-voronoi Voronoi Pattern
@ninmonkey
ninmonkey / importing-local-powerquery.md
Created August 31, 2022 01:16
How to import External Power Query from text files.md

Example "lib"

Instead of a table, end up with a record, which can contain any number of functions

let
    // attempt to convert any type to Csv string
    ToCsv = (source as list) as text =>
        let
@santisq
santisq / Split-Csv.ps1
Last active September 7, 2022 15:47
Simple PowerShell function that allows to split a CSV by parts or by size using `StreamReader` and `StreamWriter`
function Split-Csv {
[CmdletBinding(DefaultParameterSetName = 'ByParts')]
param(
[Parameter(Mandatory, ValueFromPipelineByPropertyName)]
[alias('FullName')]
[string] $Path,
[parameter(Mandatory)]
[string] $DestinationFolder,
@santisq
santisq / Slide Show from API.ps1
Last active October 14, 2022 19:35
simple Windows Forms Slide Show
using namespace System.Windows.Forms
using namespace System.Drawing
using namespace System.IO
using namespace System.Management.Automation.Runspaces
Add-Type -AssemblyName System.Drawing, System.Windows.Forms
[Application]::EnableVisualStyles()
$tracker = @{}
@ninmonkey
ninmonkey / Format-NullText.ps1
Last active August 12, 2022 17:24
Formatting nulls and blanks
$Color = @{
Bright_Text = @(
$PSStyle.background.FromRgb(220, 220, 220)
$PSStyle.foreground.FromRgb(40, 40, 40)
) -join ''
Dim_Text = @(
# $PSStyle.background.FromRgb(170, 170, 170)
$PSStyle.foreground.FromRgb(120, 120, 120)
) -join ''
Reset = $PSStyle.Reset