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
<ul> | |
{[1, 2, 3, 4, 5].map(i => <li>{i}</li>)} | |
</ul> |
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
//helper function | |
function groupBy(objectArray, property) { | |
return objectArray.reduce((acc, obj) => { | |
const key = obj[property]; | |
if (!acc[key]) { | |
acc[key] = []; | |
} | |
// Add object to list for given key's value | |
acc[key].push(obj); | |
return acc; |
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
dest.cs | |
dest/ | |
save.ps1 | |
source.cs | |
source.dll |
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
# base64 to hex | |
echo -n AwCYPg== | base64 -d | xxd -ps | |
# hex to base64 | |
echo -n 0300983e | xxd -r -p | base64 |
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
# C# syntax works under both pwsh core and legacy Windows Powershell which is capped at C# 5.0 and .Net Framework vs dotnet core | |
Add-Type @" | |
using System; | |
using System.IO; | |
public static class BigCsvSplitter | |
{ | |
public static void Run() |
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://github.com/bubkoo/html-to-image | |
//load systemjs as a way to import html-to-image library which is published as node module with require dependencies | |
//you could do this via normal <script> tag as well | |
var script = document.createElement("script"); | |
script.setAttribute("src", "https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.21.6/system.js"); //new SystemJs doesn't support CJS modules | |
document.body.appendChild(script); | |
//set .js as default extension for nested dependencies "require()'d" from index.js below | |
System.config({ |
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://www.nuget.org/packages/Microsoft.Net.Compilers.Toolset | |
md cs-repl | cd | |
nuget install Microsoft.Net.Compilers.Toolset | |
# run a CS script, a useful alternative to PowerShell itself | |
echo 'Console.WriteLine("hello");' > script.csx | |
. (gci -recurse csi.exe).FullName script.csx | |
# run in REPL mode |
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 CheckFolderExistsAndCreate(folder) { | |
if (fso.FolderExists(folder)) { | |
WScript.Echo("destination folder already exists: " + folder); | |
WScript.Quit(1); | |
} | |
fso.CreateFolder(folder); | |
} | |
//probe the zip file for depth/complexity |
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
# all syntax is pwsh v7+ compatible | |
########################################### | |
# the basic scenario is wanting to fire another codegen tool whenever `dotnet watch run` reports a change to specific source files | |
# it's very fortunate dotnet watch already reports exactly what we need to trigger on | |
########################################### | |
# this code is very customized to watch my ServiceStack webapi project | |
# and run the ServiceStack CLI tooling that autogens typescript DTOs from C# DTOs. | |
# | |
# i've also tailored to watching for specific errors, and trimming the debug output verbosity and changing console text color to catch the eye |
NewerOlder