Skip to content

Instantly share code, notes, and snippets.

View jonlabelle's full-sized avatar

Jon LaBelle jonlabelle

View GitHub Profile
@jonlabelle
jonlabelle / bem_cheatsheet.md
Last active January 1, 2022 06:12
BEM cheatsheet
title subtitle date source
BEM cheatsheet
Block Element Modifier (BEM) naming convention cheatsheet.
June 13, 2021

BEM cheatsheet

The name of a BEM entity is unique. The same BEM entity always has the same name

@jonlabelle
jonlabelle / Get-Basename.ps1
Last active October 11, 2023 05:21
Gets the file name or directory portion of a path. Similar (but not exact) to the posix BASENAME(1) command, written in PowerShell.
function Get-Basename
{
<#
.SYNOPSIS
Gets the file name or directory portion of a path.
Somewhat similar to the POSIX BASENAME(1) command, written in PowerShell.
.DESCRIPTION
The Get-Basename cmdlet strips any prefix ending with the last slash
character present in string (after first stripping trailing slashes),
@jonlabelle
jonlabelle / compare_versions.sh
Last active October 6, 2023 19:02
Compare Semver Versions in Bash
#!/usr/bin/env bash
#
# Performs a simple semver comparison of the two arguments.
#
# Original: https://github.com/mritd/shell_scripts/blob/master/version.sh
# Snippet: https://jonlabelle.com/snippets/view/shell/compare-semver-versions-in-bash
# Gist: https://gist.github.com/jonlabelle/6691d740f404b9736116c22195a8d706
#
@jonlabelle
jonlabelle / npm_version_cheatsheet.md
Last active April 26, 2024 15:45
npm version cheatsheet

npm version cheatsheet

npm uses Semantic Versioning

npm uses Semantic Versioning. Given a version number MAJOR.MINOR.PATCH, increment the:

  1. MAJOR version when you make incompatible API changes,
  2. MINOR version when you add functionality in a backwards compatible manner, and
  3. PATCH version when you make backwards compatible bug fixes.
@jonlabelle
jonlabelle / dotnet-format-wrapper.sh
Last active August 16, 2021 09:44
Bash wrapper script for the .NET Format global CLI tool.
#!/usr/bin/env bash
#
# Bash wrapper script for the .NET Format global CLI tool.
#
# Author........: Jon LaBelle
# Date..........: February 4, 2021
# Snippet.......: https://jonlabelle.com/snippets/view/shell/net-format-bash-wrapper-script
# Gist..........: https://gist.github.com/jonlabelle/a0751768a220274a90d4be498da51643
# .NET Format...: https://github.com/dotnet/format
@jonlabelle
jonlabelle / dontet_unit_test_framework_translation_cheatsheet.md
Last active September 27, 2023 15:30
.NET Unit Test Framework Translation Cheatsheet
@jonlabelle
jonlabelle / ldap_search_filter_cheatsheet.md
Last active April 25, 2024 13:01
LDAP Search Filter Cheatsheet
@jonlabelle
jonlabelle / NormalizeLineEndings.cs
Last active August 22, 2023 13:28
Normalize line endings in C#.
/// <summary>
/// Normalize line endings.
/// </summary>
/// <param name="lines">Lines to normalize.</param>
/// <param name="targetLineEnding">If targetLineEnding is null, Environment.NewLine is used.</param>
/// <exception cref="ArgumentOutOfRangeException">Unknown target line ending character(s).</exception>
/// <returns>Lines normalized.</returns>
/// <remarks>
/// https://jonlabelle.com/snippets/view/csharp/normalize-line-endings
/// </remarks>