Skip to content

Instantly share code, notes, and snippets.

@saadshahd
saadshahd / README.md
Last active August 12, 2025 23:26
Cognitive Load Analyzer for Code Reviews - claude code statusline

Cognitive Load Status Line for Claude Code

Real-time cognitive load analyzer that shows how complex your current changes are in Claude Code's status bar.

What It Shows

CL: 🟢 Low (3 chunks) | Ready for review
CL: 🟡 Medium (7 chunks) | Split: async + rest  
CL: 🔴 High (12 chunks) | ⚠️ Complexity: 20 (critical) - Refactor before review
@saadshahd
saadshahd / fp-eval.py
Created August 11, 2025 14:36
McCarthy's eval in modern FP terms - python
def eval(expr, env):
return match expr:
case Atom(x): Success(lookup(env, x))
case List(['quote', x]): Success(x)
case List(['if', cond, then, else_]):
eval(cond, env).flatmap(
lambda v: eval(then if v else else_, env)
)
case List([fn, *args]):
@saadshahd
saadshahd / cloudSettings
Last active January 28, 2022 20:16
Visual Studio Code Settings Sync Gist
{"lastUpload":"2022-01-28T20:16:28.891Z","extensionVersion":"v3.4.3"}
@saadshahd
saadshahd / machine.js
Created September 30, 2020 13:22
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@saadshahd
saadshahd / machine.js
Last active November 4, 2020 12:10
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
@saadshahd
saadshahd / machine.js
Last active September 7, 2020 14:07
Generated by XState Viz: https://xstate.js.org/viz
const statusMachine = Machine({
id: "status",
type: "parallel",
states: {
info: {
initial: "Created",
states: {
Created: {
on: {
OFFICIALLY_SCHEDULED: "OfficiallyScheduled"
@saadshahd
saadshahd / machine.js
Last active March 25, 2020 20:18
Generated by XState Viz: https://xstate.js.org/viz
const test = (regex, base) => base && base.name && regex.test(base.name);
const isStart = ({ base }) => test(/^start-/, base);
const isFull = ({ base }) => !test(/^start-/, base);
const baseMachine = Machine({
id: 'base',
initial: 'init',
context: {
startBase: null,
base: {}
@saadshahd
saadshahd / svg-to-icon.js
Last active August 7, 2017 22:14
Runtime generator not found
const path = require('path');
const pascalCase = require('pascal-case');
const {stringifyRequest} = require('loader-utils');
const {stringifySymbol, stringify} = require('../../lib/utils');
module.exports = function ({symbol, config, context, loaderContext}) {
const {spriteModule, symbolModule, runtimeOptions} = config;
const compilerContext = loaderContext._compiler.context;
const iconModulePath = path.resolve(compilerContext, runtimeOptions.iconModule);
function getSameCharStrings(strings) {
const repeatedCharsOrSpaceRegex = /(\w)(?=.*\1)|\s/g;
const uniqueSortedChars = strings.map(word => {
return word
.replace(repeatedCharsOrSpaceRegex, '')
.split('')
.sort()
.join('');
});
// Generates two conditional methods
// 1. (isBroken: true, method: 'some') filters the abandoned shipments
// 2. (isBroken: false, method: 'every') filters the ready shipments
function checkShipment(isBroken, method) {
return function (curShipment) {
return curShipment.packagesList[method](function (curPackage) {
return curPackage.isBroken === isBroken;
});
};
}