Skip to content

Instantly share code, notes, and snippets.

View jbrz0's full-sized avatar
🦾

jbrz0 jbrz0

🦾
View GitHub Profile
@jbrz0
jbrz0 / array-flatten-function.js
Last active May 31, 2018 22:03
Flatten Arrays in Javascript, transform multiple nested arrays into one
function flatten(ary) {
var ret = [];
for(var i = 0; i < ary.length; i++) {
if(Array.isArray(ary[i])) {
ret = ret.concat(flatten(ary[i]));
} else {
ret.push(ary[i]);
}
}
return ret;
@jbrz0
jbrz0 / useExcerpt.ts
Created August 2, 2020 14:48
useExcerpt: React hook for easy multi line text excerpts
/*
Usage
import {useExcerpt} from '../../hooks/useExcerpt'
1.
Import or store long text in a variable
const text = 'some really long text'
2.
@jbrz0
jbrz0 / no-mock-data.msc
Created March 24, 2025 18:18
No mock data cursor rule
# Production-Quality Rule: No Mock Data or Temporary Solutions
This rule mandates that all generated code must be fully production-ready. No mock data, placeholder values, or temporary quick-fix solutions are allowed. If a complete and robust solution isn’t achievable, the system must instead produce an error so that the issue can be addressed properly.
No Mock Data:
- Do not generate or include any mock data or dummy values in any code or example.
- All data should reflect real-world, applicable scenarios.
No Temporary Solutions:
- Avoid any hacky, provisional, or quick-fix implementations solely to get a server or app running.
@jbrz0
jbrz0 / docker-restart.msc
Created March 26, 2025 02:24
Docker container restart cursorrule
# Docker Container Restart Rule
Description:
This rule directs the AI to provide guidance for restarting Docker containers instead of suggesting direct docker commands. When a container restart is needed, the AI must indicate which container (based on the Dockerfile context) should be restarted and leave the manual execution to the user. Additionally, the AI should verify context to avoid incorrect suggestions such as "npm run dev" when the service is actually running inside a Docker container.
Guidelines:
Restart Relevant Docker Containers:
Analyze the Dockerfile to determine which container(s) are relevant for the current service.