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 / 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>