Skip to content

Instantly share code, notes, and snippets.

View mikegwhit's full-sized avatar
🎯
Focusing

Mike Whit mikegwhit

🎯
Focusing
View GitHub Profile
const { GoogleGenerativeAI } = require('@google/generative-ai');
const dotenv = require('dotenv');
const { execSync } = require('child_process');
const fs = require('fs');
dotenv.config();
// Initialize the API with your key
const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY);

You are an expert software engineer. Your task is to analysis the following unified code diff and its code changes. Your objective is to analyze each file for the following error and warning codes (as defined by their descriptors).

You should provide a per file analysis working with the following common problem areas:

(ERR_LARGE_FN)

Definition: A function exceeding 200 lines of code is considered overly large and should be refactored into smaller, cohesive units.

You are an expert software engineer. Your task is to review the following unified code diff and its code changes. You should review the existing unified code diff and identify any obvious problems with it and propose new diffs to apply that are compatible with running git apply --3way --check

For specific diff changes and code cleanup, common issues we want to screen for include:

(ERR_LINGERING_CONSOLE_LOG)

@mikegwhit
mikegwhit / yelp-categories.json
Created July 23, 2025 16:53
Yelp Categories
{
"categories": [
{
"name": "Active Life",
"activities": [
"Airsoft",
"Amateur Sports Teams",
"Amusement Parks",
"Aquariums",
"Archery",
#!/bin/bash
# git-diff-json.sh - Get Git diff information in JSON format
#
# Usage:
# ./git-diff-json.sh [directory] [options]
#
# Options:
# --compare-branch, -c Branch to compare against (default: main)
# --no-local-changes, -n Don't include local changes in comparison
/**
* Chat-session cost estimator, accounting for character-based token growth
* and optional OpenAI-style cached token discounting.
*
* @param {Object} opts
* @param {number} opts.turns – number of user↔assistant turns
* @param {number} opts.totalChars – total characters across the full script
* @param {number} [opts.charsPerTok] – avg chars per token (English ≈ 4)
* @param {number} [opts.inputCost] – $ / 1,000 input tokens
* @param {number} [opts.outputCost] – $ / 1,000 output tokens
/**
* Problem: Word Ladder
*
* Given a `beginWord`, an `endWord`, and a list of `wordList`:
* Transform `beginWord` into `endWord` by changing **only one letter at a time**,
* and each intermediate word must exist in the `wordList`.
*
* Return the **minimum number of transformations** required.
* If no such sequence exists, return 0.
*
/**
* Problem: Detect Cycle in a Directed Graph
*
* You are given a directed graph represented as an adjacency list.
* Each key is a node, and its value is an array of neighbors.
*
* Goal:
* Return true if the graph contains a **cycle**, false otherwise.
*
* Example:
/**
* Problem: Coin Change (Leetcode #322)
*
* You are given an array of coin denominations `coins` and an integer `amount`.
* Return the **fewest number of coins** needed to make up that amount.
*
* If it's not possible, return -1.
*
* You may use **each coin unlimited times** (unbounded knapsack).
*
/**
* Problem: 0/1 Knapsack
*
* You are given two arrays:
* - weights[i] = weight of the i-th item
* - values[i] = value of the i-th item
*
* And an integer `capacity` representing the max weight the knapsack can hold.
*
* Goal: