PoshCode Archive  Artifact [e474d22b51]

Artifact e474d22b51db69ef4eea42708a2ef8d1fec0c983ff0e4f7ddc2f8290fa9612bf:

  • File LetterDiamondOneliner-v2.ps1 — part of check-in [09f96797e2] at 2018-06-10 12:56:18 on branch trunk — @Karl (user: Robert Robelo size: 772)

# encoding: ascii
# api: powershell
# title: LetterDiamondOneliner v2
# description: @Karl
# version: 0.1
# author: Robert Robelo
# license: CC0
# x-poshcode-id: 1041
# x-archived: 2009-04-22T08:05:33
#
# > ...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 124 chars w/o arg
&{$r=,(' '*($p=[char]$args[0]-($s=65))+[char]$s);do{$r+="{0,$p} {1}{0}"-f[char]++$s,('  '*$f++)}until(!--$p);$r;$r[-2..-99]}J