Skip to content

Instantly share code, notes, and snippets.

View carlin-q-scott's full-sized avatar

Carlin Scott carlin-q-scott

View GitHub Profile

Find in Files snippets

These are snippets I use to find text in specific types of files.

CSS

.css;.scss;!*.min.css

@carlin-q-scott
carlin-q-scott / robots.cshtml
Last active June 29, 2022 19:49
robots.txt Razor Page
@page "/robots.txt"
@{
Layout = null;
Response.ContentType = "text/plain";
}
@using Microsoft.AspNetCore.Hosting
@inject IHostingEnvironment env
User-agent: *
@if (env.IsProduction())
{
@carlin-q-scott
carlin-q-scott / access.yaml
Created November 4, 2022 19:39
Lightweight helm-controller providing HelmChart and HelmChartConfig CRDs
apiVersion: v1
kind: ServiceAccount
metadata:
name: helm-controller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: helm-controller
@carlin-q-scott
carlin-q-scott / unobtrustive-validation-extensions.js
Last active November 12, 2022 02:51
ASP.NET Unobtrusive Validation for Bootstrap 5
(function ($) {
// Make ASP's unobtrusive validation compatible with Bootstrap 5 styling. See this for more details: https://stackoverflow.com/a/19006517/576153
$.validator.setDefaults({
errorElement: "span",
errorClass: "invalid-feedback",
highlight: function (element, errorClass, validClass) {
// Only validation controls
if (!$(element).hasClass('novalidation')) {
$(element).closest('.form-control').removeClass('is-valid').addClass('is-invalid');
}

Azure Application Insights in Kubernetes for Java

This gist describes how to add Kubernetes customDismensions to the Java agent for Application Insights.

It's supplying the same customDimensions that are provided by the asp.net 6+ instrumentiation, except that not all of those dimensions are available using the Kubernetes Downward API

How it Works

The supplied app-insights-java.yaml patch file configures customDimensions for the app insights agent using the APPLICATIONINSIGHTS_CONFIGURATION_CONTENT env var. This will override your applicationinsights.json configuration file if you were using one.

@carlin-q-scott
carlin-q-scott / detect-touch-issues.js
Last active July 31, 2023 20:50
Detect Google Search Ranking Issues
// This script highlights touchable elements on the page that are either too small or too close together according to Google.
// https://support.google.com/webmasters/answer/9063469#touch_elements_too_close
const MinimumSize = 48;
const MinimumMargin = 8;
let clickableNodesList = document.querySelectorAll('a,button');
for (let ia = 0; ia < clickableNodesList.length; ia++){
let aElement = clickableNodesList[ia];
let aBound = aElement.getBoundingClientRect();
@carlin-q-scott
carlin-q-scott / bash-extensions.sh
Created February 17, 2024 18:52
WSL2 Bash Extensions
echo "setting alias clip-branch to copy the current git branch to the Windows clipboard"
echo "alias clip-branch='git rev-parse --abbrev-ref HEAD | tr -d '\n' | clip.exe'"
@carlin-q-scott
carlin-q-scott / ReferenceResolverWithNames.cs
Last active April 28, 2024 18:05
A JSON.Net IReferenceResolver that resolves field references using a Name property if available, otherwise it uses an index
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json.Serialization;
namespace MyNewtonsoftExtensions
{
public class ReferenceResolverWithNames : IReferenceResolver
{
private readonly ReferenceCollection _collection = new ReferenceCollection();