Skip to content

Instantly share code, notes, and snippets.

View danpetitt's full-sized avatar

Dan Petitt danpetitt

View GitHub Profile

Keybase proof

I hereby claim:

  • I am danpetitt on github.
  • I am coderangerdan (https://keybase.io/coderangerdan) on keybase.
  • I have a public key whose fingerprint is 903F DB11 F61C DA3C 1C44 08A2 1D0A 0A6F 8973 3FF7

To claim this, I am signing this object:

@danpetitt
danpetitt / launch.json
Created December 11, 2019 15:24
Debug Yeoman Generator using VSCode 2019
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
// To find location of yo folder type:
// 'which yo'
// and then replace the end segments '/npm/yo' with '/npm/node_modules/yo/lib/cli.js'
"version": "0.2.0",
@danpetitt
danpetitt / commit-msg
Created February 21, 2020 22:39
Semantic Release Git Hook
#!/bin/sh
# Config options
min_length=4
max_length=50
types=("feat" "fix" "perf")
# End config options
@danpetitt
danpetitt / nvmuse.md
Last active July 10, 2024 01:22
Using nvmrc on Windows

Using nvmrc on Windows

Unfortunately nvm use on Windows does not change the node version to that specified in the .nvmrc file as its not supported on nvm for Windows: coreybutler/nvm-windows#388

So the easiest solution to this is to use a simple Powershell command that performs an approximation of the command as follows: nvm use $(Get-Content .nvmrc).replace( 'v', '' );

However, thats a bit awkward and we can do a bit more so instead, we can create an 'alias' to a function that calls the command instead:

function callnvm() {
@danpetitt
danpetitt / deployables.md
Last active March 25, 2024 16:17
Nuget Spec for Deploying Windows Redistributable DLLs

Nuget Definitions for Redistributing Windows DLLs for Azure App Service

Copy the following from your C:\Windows\System32 folder into a new folder "x64" alongside the nuspec file:

  • msvcp140.dll
  • vcruntime140.dll
  • vcruntime140_1.dll

Copy the following from your C:\Windows\SysWOW64 folder into a new folder "x86" alongside the nuspec file:

  • msvcp140.dll
  • vcruntime140.dll
@danpetitt
danpetitt / adr.md
Last active March 18, 2021 12:13
Installing ADR Tools in WSL in Windows

Installing ADR Tools into WSL in Windows

  • Download the latest tools from adr-tools releases page
  • Extract the src folder and rename it to adr-tools, put it somewhere you can easily get to (c:\projects for example)
  • Open up your Ubuntu WSL image bash shell in Windows Terminal
  • Execute following commands:
cd /usr/local/bin/
sudo mkdir adr-tools
cd adr-tools
@danpetitt
danpetitt / Program.cs
Created September 9, 2021 16:11 — forked from DanielSWolf/Program.cs
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);
@danpetitt
danpetitt / profile.md
Created December 23, 2021 16:45
Simplified DotNet CLI Script

If, like me, you create new DotNet projects using the same layout and options; the following script should help.

Type $profile in your Powershell Windows Terminal and edit the file at the path given by putting the following code in:

# ---------- dot net new simple alias for project creation
function Show-Menu {
  param (
      [string]$Title
  )
@danpetitt
danpetitt / machine-setup.ps1
Last active February 6, 2022 18:31
Machine Setup using WinGet
Write-Host "Downloading and installing latest WinGet app...";
# Find latest version of WinGet
$wingetrooturl = "https://github.com/microsoft/winget-cli/releases/";
$wingetpage = "$($env:TEMP)\WinGet.html";
Invoke-WebRequest -Uri $wingetrooturl -OutFile $wingetpage
# Locate first msix bundle link
[regex]$regex = "<a href=`".*?(download\/v[0-9]+\.[0-9]+\.[0-9]+\/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle)`" rel=`"nofollow`">";
@danpetitt
danpetitt / esmodules.md
Last active November 12, 2024 13:11
Typescript, Jest and ECMAScript Modules

Typescript, Jest and ECMAScript Modules (ESM)

Package.json

Add the type property to package.json to ensure modules are supported:

{
  "type": "module",
}