This file contains 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 WARMUP_LOOPS = 100000; | |
//#region Utils | |
function escapeRegExp(string) { | |
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string | |
} | |
function createUserObj() { | |
return { | |
id: 123, |
This file contains 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
param( | |
[ValidateSet("DEV","TEST","PROD")] | |
[parameter(mandatory=$true)] | |
[string]$Environment = ("DEV","TEST","PROD") | |
) | |
# TODO | |
# Update with newer code patterns | |
$path = Split-Path -Path $MyInvocation.MyCommand.Path | |
$scriptName = [System.IO.Path]::GetFileNameWithoutExtension($MyInvocation.MyCommand.Source) |
This file contains 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
{ | |
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", | |
"blocks": [ | |
{ | |
"alignment": "left", | |
"segments": [ | |
{ | |
"background": "#00c7fc", | |
"foreground": "#000000", | |
"style": "diamond", |
This file contains 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
async function* iteratorGen(arr) { | |
for (const i of arr) { | |
if (typeof i === "function") { | |
yield i(); | |
} else { | |
yield i; | |
} | |
} | |
} |
This file contains 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
# https://stackoverflow.com/a/22558858 | |
Get-ChildItem -Include *.js, *.css, *.html -Recurse | ForEach-Object { | |
$_ | Select-Object FullName, @{n = "Lines"; e = { Get-Content $_ | Measure-Object -Line | Select-Object -ExpandProperty Lines}}} |
This file contains 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
function logMsg($text, $color = [System.ConsoleColor]::green) { | |
Write-Host $text -foregroundcolor $color | |
Write-Host "`r`n" | |
} | |
<# | |
function Remove-DirectoryPathInfo ($fileInfo) { | |
$fileInfo.Path = $fileInfo.Path -replace "$([Regex]::Escape($testFiles[0].Parent.Parent.FullName))\\", "" | |
$fileInfo.Path = $fileInfo.Path -replace "$([Regex]::Escape($initialFiles[0].Parent.Parent.FullName))\\", "" | |
# "$([Regex]::Escape($parentDirectoryPath))\\" |
This file contains 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
// https://nodejs.org/api/util.html#util_util_format_format_args | |
// util.format() is a synchronous method that is intended as a debugging tool. | |
// Some input values can have a significant performance overhead that can block | |
// the event loop. Use this function with care and never in a hot code path. | |
const { format } = require("util"); | |
function log(...args) { | |
// Note the subtle difference in the output. The %j is converted to JSON. | |
const msg = format("%j %s %s %s", ...args); |
This file contains 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
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path | |
Push-Location $scriptDir | |
Add-Type -Path "$scriptDir\dll\log4net.dll" | |
$FileAppender = New-Object log4net.Appender.FileAppender( | |
( | |
[log4net.Layout.ILayout](New-Object log4net.Layout.PatternLayout('%date{yyyy-MM-dd HH:mm:ss.fff} | %level | %property{correlationId} | [%thread] | Department | App_Name | %c | $property{jobId} | %message%n')), | |
"$scriptDir\LogOutputInConsoleAndFile.log", # $LogFileName |
This file contains 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
$i = 0 | |
while($true) { | |
$password = ConvertTo-SecureString "admin" -AsPlainText -Force | |
$cred = New-Object System.Management.Automation.PSCredential "admin", $password | |
$i++ | |
$body = "test$i" | |
Invoke-RestMethod -Uri "http://activemq:8161/api/message/mqttsignal?type=topic" -Method Post -ContentType "text/plain" -Credential $cred -Body $body |
This file contains 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
;(function() { | |
// Is MDS enabled? | |
if ("undefined" != typeof g_MinimalDownload && g_MinimalDownload && (window.location.pathname.toLowerCase()).endsWith("/_layouts/15/start.aspx") && "undefined" != typeof asyncDeltaManager) { | |
// Register script for MDS if possible | |
RegisterModuleInit("init.js", init); //MDS registration | |
init(); //non MDS run | |
} else { | |
init(); | |
} |
NewerOlder