Skip to content

Instantly share code, notes, and snippets.

View imroca's full-sized avatar
👾
En taro Adun Executor

Ignacio Rojas imroca

👾
En taro Adun Executor
View GitHub Profile
@imroca
imroca / languages.toml
Created September 11, 2026 19:04
Helix Languages
# ── Rust ────────────────────────────────────────────────────────────────────
[[language]]
name = "rust"
auto-format = true
formatter = { command = "rustfmt" }
# ── Rust LSP config ─────────────────────────────────────────────────────────
[language-server.rust-analyzer.config.check]
command = "clippy"
@imroca
imroca / config.toml
Created September 11, 2026 19:02
Helix Config
theme = "github_dark_dimmed"
[editor]
line-number = "relative"
cursorline = true
bufferline = "multiple"
true-color = true
color-modes = true
rulers = [120]
auto-format = true
@imroca
imroca / safeFetch.ts
Created August 4, 2026 14:35
Typed Fetch wrapped in Try Promise pattern
async function safeFetch<TResponse>(
url: string | URL,
options: RequestInit & { body?: unknown } = {}
): Promise<[data: TResponse, error: null] | [data: null, error: Error]> {
try {
const { body, headers, ...restOptions } = options;
const isFormData = body instanceof FormData;
const response = await fetch(url, {
...restOptions,
@imroca
imroca / typed-fetch-matt.ts
Created August 3, 2026 23:40
Building a type-safe fetch in #typescript by @mattpocockuk
export const get = async (
url: string,
input: Record<string, string>
) => {
return fetch(
`${url}?${new URLSearchParams(input).toString()}`
);
};
export const post = async (
@imroca
imroca / schema.ts
Last active June 17, 2026 16:04
Paraguayan Zod MSISDN / Cellphone Schema Validator
import { z } from "zod";
const paraguayMobileRegex =
/^(?:(?:\+?595|0)9|9?)(?:8[1-7]|7[1-6]|9[1-5]|6[1-3])\d{6}$/;
export const paraguayPhoneSchema = z
.string()
.trim()
.regex(paraguayMobileRegex, "Número de celular paraguayo inválido")
.transform((val) => {
@imroca
imroca / .my.cnf
Last active October 23, 2025 14:00
MySQL Client Config
[client]
user=dbuser
password=dbpassword
host=dbhost
database=dbname
[mysql]
pager=less -n -i -S -F -X
prompt="@\u [\d] → "
@imroca
imroca / api-client.ts
Last active June 9, 2025 16:54
Axios Api Client
import Axios, { isAxiosError } from "axios";
import type {
CreateAxiosDefaults,
AxiosInstance,
AxiosResponse,
InternalAxiosRequestConfig,
} from "axios";
export const createApiClient = (config: CreateAxiosDefaults): AxiosInstance => {
const api = Axios.create(config);
@imroca
imroca / jsconfig.json
Created April 16, 2025 21:02
Node path aliasing
{
"compilerOptions": {
"baseUrl": "src",
"paths": {
"#*": [
"./src/*"
]
}
}
}
@imroca
imroca / init.lua
Last active September 24, 2025 18:43
ChatGPT Minimal nvim config // ~/.config/nvim/init.lua
-- Basic settings
vim.opt.number = true -- Show line numbers
vim.opt.relativenumber = true -- Show relative line numbers
vim.opt.clipboard = "unnamedplus" -- Enable system clipboard integration
vim.opt.expandtab = true -- Use spaces instead of tabs
vim.opt.shiftwidth = 4 -- Number of spaces per indentation
vim.opt.tabstop = 4 -- Number of spaces for a tab
vim.opt.termguicolors = true -- Enable true color support
vim.opt.wrap = false -- Disable line wrapping
vim.opt.swapfile = false -- Disable swap file creation
@imroca
imroca / validate.ts
Last active November 7, 2025 17:40
Validate Auth0 id_token
import jwt from "jsonwebtoken";
import jwksClient from "jwks-rsa";
const idToken = "<idtoken>";
const decoded = jwt.decode(idToken, { complete: true }) as any;
const { kid } = decoded.header;
const { iss } = decoded.payload;
const response = await fetch(