Skip to content

Instantly share code, notes, and snippets.

View albertocavalcante's full-sized avatar
🌎
BRA -> USA

Alberto Cavalcante albertocavalcante

🌎
BRA -> USA
View GitHub Profile
@titobundy
titobundy / copilot-instructions.md
Last active June 26, 2025 19:19 — forked from burkeholland/copilot-instructions.md
Custom Instructions Example

Vite / React / Tailwind / Nanostores / Astro Best Practices

This guide outlines best practices for building a Vite / React / Tailwind / Nanostores / Astro application. The goal is readability and maintainability, minimizing abstraction to keep the codebase clear.

Tech Stack Overview

  • Astro
  • Preact
  • Nanostores
  • Tailwind CSS
  • Postgres
@digitarald
digitarald / mcp.json
Last active May 4, 2025 08:32
MCP Template for VS Code GitHub Copilot
{
"inputs": [
{
"type": "promptString",
"id": "github-pat",
"password": true,
"description": "GitHub Personal Access Token (PAT, https://github.com/settings/personal-access-tokens/new)"
}
],
"servers": {
@leehanchung
leehanchung / cli.mjs
Last active August 5, 2025 09:35
formatted claude code cli.mjs
This file has been truncated, but you can view the full file.
#!/usr/bin/env -S node --no-warnings=ExperimentalWarning --enable-source-maps
// Claude Code is a Beta product per Anthropic's Commercial Terms of Service.
// By using Claude Code, you agree that all code acceptance or rejection decisions you make,
// and the associated conversations in context, constitute Feedback under Anthropic's Commercial Terms,
// and may be used to improve Anthropic's products, including training models.
// You are responsible for reviewing any code suggestions before use.
// (c) Anthropic PBC. All rights reserved. Use is subject to Anthropic's Commercial Terms of Service (https://www.anthropic.com/legal/commercial-terms).
@dududko
dududko / .vscode_settings.json
Last active July 10, 2025 01:02
The example on how to enable autocompletion for python code in bazel workspace in VS Code. The concept of this solution is to create a repository based on `requirements_lock.txt` file that will contain symbolic links to external python packages in bazel workspace. This approach allows to keep the `.vscode/settings.json` file small.
{
// Enable autocompletion for Python
"python.analysis.extraPaths": ["${workspaceFolder}/external/+vs_code_python_autocompletion+py_deps"],
}
@iamarcel
iamarcel / search-gpt.py
Created February 11, 2023 12:57
Basic GPT-3 + Bing Answering Machine
import os
import openai
import requests
from pprint import pprint
import dotenv
dotenv.load_dotenv()
openai_api_key = os.environ.get("OPENAI_API_KEY")
bing_search_api_key = os.environ['BING_SEARCH_V7_SUBSCRIPTION_KEY']
package main
import (
"bufio"
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
@wilsonfreitas
wilsonfreitas / rb3-indexes-donuts.R
Created May 30, 2022 10:47
Indexes Composition in a Donuts Plot
library(rb3)
library(tidyverse)
top_weight <- function(.data, n = 10) {
top_10 <- .data |>
arrange(desc(weight)) |>
slice_head(n = n) |>
select(symbol, weight)
total_weight <- sum(top_10$weight)
others <- tibble(
@rponte
rponte / BeanValidationConfig.java
Last active December 27, 2021 20:33
Spring Boot: integrating Bean Validation between Spring and Hibernate (supporting DI on custom validations with Hibernate)
@Configuration
public class BeanValidationConfig {
/**
* The idea here is to configure Hibernate to use the same ValidatorFactory used by Spring,
* so that Hibernate will be able to handle custom validations that need to use dependency injection (DI)
*/
@Bean
public HibernatePropertiesCustomizer hibernatePropertiesCustomizer(final Validator validator) {
return new HibernatePropertiesCustomizer() {
@tokrug
tokrug / ConditionalOnConfigurationProperties.java
Last active August 26, 2025 01:26
Spring Boot autoconfiguration conditional annotation on typesafe ConfigurationProperies class. Maps properties to the provided class and executes it's isPresent() method to determine if Conditional should match or not. application.yml, ExampleSpringConfiguration.java and ExampleSpringPropertiesModel.java show how the rest of the code can be used.
/**
* Metannotation for OnConfigurationPropertiesCondition custom conditional implementation.
*/
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Conditional(OnConfigurationPropertiesCondition.class)
public @interface ConditionalOnConfigurationProperties {
// properties namespace
@moscas
moscas / Sum.groovy
Created December 8, 2020 13:38
Data extractor for IntelliJ which counts the sum of numeric values
/*
* Available context bindings:
* COLUMNS List<DataColumn>
* ROWS Iterable<DataRow>
* OUT { append() }
* FORMATTER { format(row, col); formatValue(Object, col); getTypeName(Object, col); isStringLiteral(Object, col); }
* TRANSPOSED Boolean
* plus ALL_COLUMNS, TABLE, DIALECT
*
* where: