This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env -S deno run --reload -A --ext=ts | |
` <#`; | |
import { readdir } from "node:fs/promises"; | |
import { join,resolve } from "node:path"; | |
import { argv } from "node:process"; | |
let size = 0; | |
let count = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env -S deno run --reload -A | |
` <#` | |
// this is all typescript code here. | |
console.log("we're running typescript using deno"); | |
/*#> | |
# this is PowerShell code here. | |
if (-not (get-command deno)) { irm https://deno.land/install.ps1 | iex } | |
deno run --reload -A ($MyInvocation.MyCommand.Path) @args | |
#*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env -S bash # > NUL 2>&1 || echo off && goto init: | |
function shh() { return; } ; shh \\<<shh | |
## THIS IS THE START OF THE POWERSHELL SCRIPT ################################# | |
# Copyright 2018 the Deno authors. All rights reserved. MIT license. | |
# TODO(everyone): Keep this script simple and easily auditable. | |
$ProgressPreference='SilentlyContinue' | |
$ErrorActionPreference = 'Stop' | |
if ($v) { | |
$Version = "v${v}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<## | |
FluentConsole Functions | |
(C) 2022 Garrett Serack | |
License: MIT | |
Usage: | |
dot source this into your script (. FluentConsole.ps1 ) | |
and then you can use the colon-prefixed functions. | |
You can separate colon-function calls with ';' or '|' or a newline. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env -S bash # > NUL 2>&1 || echo off && goto init: | |
function shh() { return; } ; shh \\<<shh | |
## THIS IS THE START OF THE POWERSHELL SCRIPT ################################# | |
write-host "Setting variable in powershell" | |
$env:abc=300 | |
return; | |
## THIS IS THE END OF THE POWERSHELL SCRIPT ################################### | |
<# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@(echo off) > $null | |
if #ftw NEQ '' goto :init | |
($true){ $Error.clear(); } | |
# unpack arguments if they came from CMD | |
$hash=@{}; | |
get-item env:argz* |% { $hash[$_.name] = $_.value } | |
if ($hash.count -gt 0) { | |
$args=for ($i=0; $i -lt $hash.count;$i++) { $hash["ARGZ[$i]"] } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@(echo off) > $null | |
set null( New-Module -ScriptBlock { function goto { }; function :{ } } )#= | |
: # This file is both a .cmd script and a powershell script. if you save it as | |
: # sample.cmd and run it it from cmd.exe it will run the same as if you | |
: # saved it as sample.ps1 and run it. | |
: # well, in this case, I added some echos on the cmd side... | |
goto :CMDSTART |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-ExecutionPolicy -Scope LocalMachine Unrestricted -force | |
$ProgressPreference=0 | |
function ResolvePath { | |
param ( | |
[string] $FileName | |
) | |
$FileName = Resolve-Path $FileName -ErrorAction SilentlyContinue ` | |
-ErrorVariable _frperror |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.defineProperties(Array.prototype, { | |
where: { value: Array.prototype.filter }, | |
select: { value: Array.prototype.map }, | |
any: { value: Array.prototype.some }, | |
all: { value: Array.prototype.every }, | |
insert: { value: function (position: number, items: Array<any>) { return (<Array<any>>this).splice(position, 0, ...items); } }, | |
selectMany: { value: function (callbackfn: (value: any, index: number, array: Array<any>) => Array<any>) { return (<Array<any>>this).select(callbackfn).flat(); } }, | |
groupByMap: { value: function (keySelector: (each: any) => any, selector: (each: any) => any) { | |
const result = new Map<any, Array<any>>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const identifier = "SomethingNOTGarrettButTLAsInASetOfEverLongerWordsTLAWithIsOfAPIsAPIssNotNOManThatYouUseWith_a_TLA"; | |
// split identifier into words | |
identifier.replace(/([a-z]+)([A-Z])/g, '$1 $2'). | |
replace(/(\d+)/g, ' $1 '). | |
replace(/\b([A-Z]+)([A-Z])s([^a-z])(.*)/g, '$1$2« $3$4'). | |
replace(/\b([A-Z]+)([A-Z])([a-z]+)/g, '$1 $2$3'). | |
replace(/«/g, 's').trim(). | |
split(/[\W|_]+/) | |
// returns: |
NewerOlder