Skip to content

Instantly share code, notes, and snippets.

@chuckconway
chuckconway / Clean-Claude.md
Created April 16, 2026 20:50
CLAUDE.md - Project rules and conventions for AI-assisted development with Claude Code

Project Rules

Authoritative reference for coding rules and conventions.

Honest Opposition (Required)

If the user's approach has a significant downside, say so — even if they seem committed. Agreeing because it's easier is a failure mode. Disagreement is part of your value.

  • State disagreements directly: "I disagree because X" — not "Great idea! One small thing..."
  • Never silently simplify, drop scope, or pivot to a different approach when blocked. Stop and ask, presenting at least two options.
dotnet ef database update --connection "Server=localhost;Database=ContractorInsights;Trusted_Connection=True;"
dotnet ef migrations add InitialCreate --context InsightsContext -o Persistence/Migrations
dotnet ef database update
dotnet ef dbcontext scaffold "Server=localhost;Database=ContractorInsights;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer
@chuckconway
chuckconway / clickable-areas.css
Created January 27, 2021 16:43
Highlights all the clickable area's on a web page
button,
a,
a > img,
a > svg,
input,
details > summary {
outline: 1px dotted rgba(128,128,128, 0.5);
outline-offset: 1px;
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<RootNamespace></RootNamespace>
<IsPackable>False</IsPackable>
<NoWarn>CS0649;CS0169</NoWarn>
@chuckconway
chuckconway / Collection.cs
Created October 29, 2019 21:22
Flattens a hierarchy of objects depth-first preserving nesting order while avoiding unnecessary iterators and stack overflows.
/// <summary>
/// Flattens a hierarchy of objects depth-first preserving nesting order while avoiding unnecessary iterators and stack overflows.
/// </summary>
/// <typeparam name="T">The type of elements to return</typeparam>
/// <param name="source">The root source of the object hierarchy</param>
/// <param name="selector">An element selector to produce children of an element</param>
/// <param name="shouldYield">A filter function. If specified should return true to yield an element</param>
/// <returns>A flattened enumeration of elements</returns>
public static IEnumerable<T> Flatten<T>(this IEnumerable<T> source, Func<T, IEnumerable<T>> selector, Func<T,bool> shouldYield = null)
{
@chuckconway
chuckconway / rename_and_group_in_directory.js
Created June 9, 2018 17:16
Parse the name and group the files into folders with nodejs.
const fs = require('fs');
const testFolder = './';
fs.readdir(testFolder, (err, files) => {
files.forEach(file => {
if(file.indexOf('-') !== -1){
/* Azure friendly */
/* Drop all Foreign Key constraints */
DECLARE @name VARCHAR(128)
DECLARE @constraint VARCHAR(254)
DECLARE @SQL VARCHAR(254)
DECLARE @SCHEMA VARCHAR(128)
SET @SCHEMA = '[dbo]'
SELECT @name = (SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE constraint_catalog=DB_NAME() AND CONSTRAINT_TYPE = 'FOREIGN KEY' ORDER BY TABLE_NAME)
var el = $('<a />').attr({
href:'api/loan/lockconfirmation/' + vm.model.info.loanNumber,
target:'_self'
});
$(document.body).append(el);
el[0].click().remove();
########################################
# Regex Patterns for Really Bad Things!
$listOfBadStuff = @(
#sln regex
"\s*(\.nuget\\NuGet\.(exe|targets)) = \1",
#*proj regexes
"\s*<Import Project=""\$\(SolutionDir\)\\\.nuget\\NuGet\.targets"".*?/>",
"\s*<Target Name=""EnsureNuGetPackageBuildImports"" BeforeTargets=""PrepareForBuild"">(.|\n)*?</Target>"
"\s*<RestorePackages>\w*</RestorePackages>"
)
@chuckconway
chuckconway / SerialDatetoDateTime.cs
Last active August 29, 2015 14:26
Converting Excel Serial Date to DateTime
private DateTime ExcelSerialDateToDMY(int nSerialDate)
{
int nDay = 0;
int nMonth = 0;
int nYear = 0;
//// Excel/Lotus 123 have a bug with 29-02-1900. 1900 is not a
//// leap year, but Excel/Lotus 123 think it is...
//if (nSerialDate == 60)
//{