Skip to content

Instantly share code, notes, and snippets.

View lfsmoura's full-sized avatar
🏠
Working from home

Leonardo Moura lfsmoura

🏠
Working from home
View GitHub Profile
@lfsmoura
lfsmoura / README.md
Created December 25, 2025 20:55
Biome GritQL plugin to enforce browserLogger instead of console in React components

Biome Plugin: no-console-in-tsx

A custom Biome GritQL plugin that prevents direct console.* usage in React components (.tsx files).

Why?

I use OpenObserve for centralized log aggregation. To ensure all browser logs are captured and sent to OpenObserve, I created a browserLogger utility that wraps console methods and forwards logs to my observability backend.

This plugin enforces that pattern by flagging any direct console.log, console.error, console.warn, console.info, or console.debug calls in React components as errors.

@lfsmoura
lfsmoura / quicksort.cpp
Created September 15, 2021 16:18
Quicksort in C++ three lines
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
void q(std::vector<int>::iterator b, std::vector<int>::iterator e) {
auto d = std::partition(b, e, [&](int s) { return s <= *b; });
if (b < e) q(b, d - 1), q(d, e);
}