Skip to content

Instantly share code, notes, and snippets.

View ferdelamad's full-sized avatar
🎯
Focusing

Fernando De La Madrid ferdelamad

🎯
Focusing
View GitHub Profile
@ferdelamad
ferdelamad / global_cursor_rules.md
Last active March 22, 2025 17:38
Global Cursor Rules

Cursor Global Rules

Core Principles

  • Split long files into smaller, focused modules (aim for <300 lines per file)
  • Refactor lengthy functions into smaller, single-purpose functions (aim for <40 lines per function)
  • Always analyze code changes for scalability, maintainability, and performance impact
  • Follow SOLID principles and design patterns appropriate to the codebase
  • Prioritize readability and testability over clever optimizations

Code Analysis

var Cashinator3000 = (priceList, startingAmount = 0, salesTax = 0.0725) => {
this.priceListCSV = priceList;
this.startingAmount = startingAmount;
this.salesTax = salesTax;
this.transactions = [];
this.transactionId = 0;
};
Cashinator3000.prototype.currentBalance = () => {
return this.startingAmount;
@ferdelamad
ferdelamad / SDC service testing with Seige
Created August 23, 2018 22:41
SDC service testing with Seige
//Testing the last 1 million records to effectively assess the caching
//Best RPM = 53.2k
//Redis strategy = --maxmemory 512mb --maxmemory-policy allkeys-lru
const siege = require("siege");
const randomNumbers = [];
const random = (min, max) => Math.floor(Math.random() * max) + min;
const arrSize = 150000;
for (let i = 0; i < arrSize; i += 1) {
5000000 | room5000000 | North Anthonyfort | Apartment | Quasi qui ut libero molestias. | 1 | 1 | 3 | 4 | Dr. Delmer O'Hara | https://s3.amazonaws.com/uifaces/faces/twitter/panchajanyag/128.jpg | In illum enim ad quibusdam nulla ea. Amet dolores molestiae libero dolore dolor voluptatem rerum. Voluptas accusamus ut est deserunt laudantium necessitatibus. | Quis placeat in qui consectetur perferendis ut est aut. Recusandae cum a dolor sunt deserunt numquam nam est. | Animi cum aut quidem dolore et fugiat. | Eum laboriosam dolor. Quia quia veniam necessitatibus.* Quas omnis repudiandae porro quia. Accusamus esse nam ut laborum aut sed. Deleniti eos eum modi alias. Amet non repellat iste enim modi illum minima itaque. Exercitationem placeat voluptatem tempore quaerat praesentium aliquid in qui. | Harum et vel. Minima omnis adipisci quas.* Quia aut sed et quia ratione laboriosam eos. Consectetur deleniti qui eos aut et.* Ut aut aliquam ut perferendis numquam. Molestias ut velit soluta modi ani
//input = array of individual chars.
//ouput = same array with double the amount of vowels.
const doubleVowels = array => {
for (let index = array.length - 1; index >= 0; index--) {
if (checkForWowels(array[index])) {
array.splice(index, 0, array[index]);
index--;
}
}
@ferdelamad
ferdelamad / kthSmallest
Created August 6, 2018 16:53
kthSmallest InterviewPrepPrompt
/**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} root
* @param {number} k
//Reacting start API Call
componentDidMount () {
let path = window.location.pathname;
path = path.split('/')[2];
const self = this;
axios.get(`/api/restaurant/${path}`)
.then((response) => {
self.setState({
data: response.data,
loaded: true,
// Problem case with floating-point arithmetic: 0.10 + 0.20 !== 0.30
// But for us, should be: 0.10 + 0.20 === 0.30
function CashAmount (amount) {
this.amount = amount;
};
CashAmount.prototype.totalInPennies = function() {
const result = this.amount * 100;
return result;
const findLargestLevel = function(n) {
//first create a holder var
const allNodes = [];
// define our recursive foo (node, depth)
function checkNodes (node, depth) {
// first add the value of the node to its current depth (in the array)
if (!allNodes[depth]) {
allNodes[depth] = 0;
}