Skip to content

Instantly share code, notes, and snippets.

View sourman's full-sized avatar
🎯
Focusing

Ahmed Mansour sourman

🎯
Focusing
View GitHub Profile
@sourman
sourman / README.md
Last active December 7, 2025 18:01
Query Supabase Edge function logs tool

Cursor Tools

Collection of helpful development tools for this project.

get-function-logs.sh

Query Supabase Edge Function console logs via the Management API.

Setup

@sourman
sourman / vite config to inject worktree slug into the browser title
Last active December 7, 2025 21:05
Cursor worktrees fast server spin up
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import path from "path";
import { componentTagger } from "lovable-tagger";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
server: {
host: "::",
port: 8080,
@sourman
sourman / gist:b744e3f89e8cbcb20be4301fecc05630
Created September 15, 2025 17:46
Deeplawn Measurement returned with no property boundary example
{
"userId": "hello_9303_conc_z2py",
"address": "9303 Concord Rd, Brentwood, TN 37027, USA",
"cartUrl": "https://app.deeplawn.com/widget?companyId=682f31d6740911fea65ed9f2&postgridurl=true&place_id=ChIJ3WczsWd6ZIgRui6dEtKTroA",
"geojson": {
"LAWN": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
#!/bin/bash
# trellis start bash script
set -e # Exit on error
echo "=== TRELLIS Launch Script Started ==="
echo "Current user: $(whoami)"
echo "Working directory: $(pwd)"
echo "Date: $(date)"
echo
MY MOST TRUSTED ENGINEER
please run git log -10 and get a sense of how I like ot write commit messages. Note how it is sussinct and tries to give the rationale whenver possible
I want you to create modular logically contianed commits as much as possible
that means do not do `git add .` and call it a day. add file by file, or if you see the diff and know how to add pice by pice then go ahead. (remeber though we cannot using itneractive adds like `git add -p`) but maybe there is a way to add lines by specifying the line numbers
@sourman
sourman / ts_to_pydantic.py
Created June 28, 2025 11:22
python script: Convert supabase typescript to pydantic models
import re
import sys
from typing import Dict, List, Any, Optional, Union
def extract_database_type(content: str):
# Very basic: extract enums under "Enums" in Database type
db_pattern = re.search(r"type Database = {(.+?)}", content, re.S)
if not db_pattern:
return {}
db_body = db_pattern.group(1)
@sourman
sourman / update_tree.sh
Created February 7, 2025 17:39
.cursorrules nextjs file structure update script
#!/bin/bash
tree -I 'tree.tmp|*.tar.gz|desktop.ini|*.pkl|delete_me|node_modules|.vscode|*.tsbuildinfo|next-env.d.ts|.env*|*.log|.vercel|build|' > tree.tmp && awk '
BEGIN {in_tree_section = 0}
/START_TREE/ {
print "START_TREE"
print "```"
system("cat tree.tmp")
print "```"
@sourman
sourman / react-example-bad-good-state-updates.tsx
Created January 26, 2025 17:56
React Example of a state update the repeats too many times because it is being called INSIDE another state update
/** Examples showing incorrect state update the violates Reacts rules because it nests
* a setSomething() call inside of setOhterThing() call. This casues the state update
* of setSomthing() to occur multiple times in a row for every call to setOtherThing()
*/
/************************************************************************************/
/*************************** BAD STATE UPDATE EXAMPLE COMPONENT *********************/
/************************************************************************************/
const badLog = (...args: any[]) => {
console.log('❌BadComponent❌ Says: ', ...args)
int a[] {1, 2, 4, 1, 5};
int g[3] {1, 2, 5};
int b[10] {4, 3, 2, 1};
string s {"potato salad " "pomegranate sauce"};
#include "LinkedList.h"
template <class T>
LinkedList<T>::LinkedList()
{
first = NULL;
last = NULL;
}
template <class T>