Skip to content

Instantly share code, notes, and snippets.

View danpetitt's full-sized avatar

Dan Petitt danpetitt

View GitHub Profile
@danpetitt
danpetitt / markdown-tips.md
Last active September 14, 2024 20:09
GitHub Markdown Updates

Note

Highlights information that users should take into account, even when skimming.

> [!NOTE]  
> Highlights information that users should take into account, even when skimming.

Tip

Optional information to help a user be more successful.

@danpetitt
danpetitt / git.md
Created June 30, 2023 11:42
Git on WSL sometimes get files with file permissions changed

Sometimes, when using Windows WSL to edit projects, Git will report a file permissions change.

You cannot fix, change, remove or do anything with these files and it causes issues when pulling.

Just do this:

git config core.filemode false
@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
  )
@ClickerMonkey
ClickerMonkey / types.ts
Last active September 16, 2025 22:30
Typescript Helper Types
// when T is any|unknown, Y is returned, otherwise N
type IsAnyUnknown<T, Y, N> = unknown extends T ? Y : N;
// when T is never, Y is returned, otherwise N
type IsNever<T, Y = true, N = false> = [T] extends [never] ? Y : N;
// when T is a tuple, Y is returned, otherwise N
// valid tuples = [string], [string, boolean],
// invalid tuples = [], string[], (string | number)[]
@danpetitt
danpetitt / nvmuse.md
Last active August 28, 2025 12:43
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 / 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 / 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",
@davidfowl
davidfowl / Global.asax.cs
Last active December 4, 2025 20:12
ASP.NET MVC and ServiceCollection sample
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Microsoft.Extensions.DependencyInjection;
using WebApplication16;
using WebApplication16.Controllers;
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\W3SVC /v SvcHostSplitDisable /t REG_DWORD /d 1 /f
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\WAS /v SvcHostSplitDisable /t REG_DWORD /d 1 /f