PoshCode Archive  Artifact [f572bec4c5]

Artifact f572bec4c52868cf007e4daf1d057304c12842d5f05914dd32ce9a06eb433e7f:

  • File LetterDiamondOneliner-v3.ps1 — part of check-in [c5f1feeaba] at 2018-06-10 12:56:18 on branch trunk — @Karl (user: unknown size: 750)

# encoding: ascii
# api: powershell
# title: LetterDiamondOneliner v3
# description: @Karl
# version: 0.1
# license: CC0
# x-poshcode-id: 1040
# x-archived: 2009-04-23T15:19:45
#
# > ...but couldn’t get it smaller than a twitter message length
# 139 chars w/o arg
#
&{param([char]$c)[int]$s=65;$p=$c-$s;$r=,(' '*$p+[char]$s);$r+=@(do{"{0,$p} {1}{0}"-f([char]++$s),('  '*$f++)}until(!--$p));$r;$r[-2..-99]}Z

# trimmed 130 chars w/o arg
&{param([char]$c)$p=$c-($s=65);$r=,(' '*$p+[char]$s);do{$r+="{0,$p} {1}{0}"-f([char]++$s),('  '*$f++)}until(!--$p);$r;$r[-2..-99]}J

# trimmed to 127 chars w/o arg
&{$p=[char]$args[0]-($s=65);$r=,(' '*$p+[char]$s);do{$r+="{0,$p} {1}{0}"-f([char]++$s),('  '*$f++)}until(!--$p);$r;$r[-2..-99]}J