Skip to content

Instantly share code, notes, and snippets.

@JamesTryand
Last active August 30, 2019 23:18
Show Gist options
  • Save JamesTryand/370f4b1b0a8bc6f78d65ebdf2be0b2db to your computer and use it in GitHub Desktop.
Save JamesTryand/370f4b1b0a8bc6f78d65ebdf2be0b2db to your computer and use it in GitHub Desktop.
1..9| %{$sb = [text.stringbuilder]::new()}{ [void]$sb.Append($_); "$([string]::Join('',[linq.enumerable]::Repeat(' ',9 - $_)))$($sb.ToString()) x 8 + $_ = $([int]$sb.ToString() * 8 + $_)" }
# for the correct coloring use
1..9| %{$sb = [text.stringbuilder]::new()}{ [void]$sb.Append($_);$ws = [string]::Join('',[linq.enumerable]::Repeat(' ',9 - $_)); "$($ws)$($sb.ToString()) x 8 + $_ = $([int]$sb.ToString() * 8 + $_)$($ws)" } | %{ write-host $_.substring(0,12) -b white -f black -NoNewline ; write-host $_.substring(12,1) -b white -f red -NoNewline ; write-host $_.substring(13) -b white -f black }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment