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 / 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 August 8, 2024 00:25
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 January 27, 2025 02:59
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 July 8, 2024 22:23
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
@addyosmani
addyosmani / README.md
Last active May 10, 2025 11:24 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@jareware
jareware / gist.md
Last active January 30, 2024 03:15
Project-specific lint rules with ESLint

⇐ back to the gist-blog at jrw.fi

Project-specific lint rules with ESLint

A quick introduction

First there was JSLint, and there was much rejoicing. The odd little language called JavaScript finally had some static code analysis tooling to go with its many quirks and surprising edge cases. But people gradually became annoyed with having to lint their code according to the rules dictated by Douglas Crockford, instead of their own.

So JSLint got forked into JSHint, and there was much rejoicing. You could set it up to only complain about the things you didn't want to allow in your project, and shut up about the rest. JSHint has been the de-facto standard JavaScript linter for a long while, and continues to do so. Yet there will always be things your linter could check for you, but doesn't: your team has agreed on some convention that makes sense for them, but JSHint doesn't have an option