Skip to content

Instantly share code, notes, and snippets.

View onmax's full-sized avatar
💭
🌍

Max onmax

💭
🌍
View GitHub Profile
@onmax
onmax / config_sanitized
Created October 14, 2025 12:47
Web Deployment Guide
## Web Cluster SSH Configuration
Host monitoring-jump
HostName monitoring.example.com
User deploy-user
IdentityFile ~/.ssh/id_deploy
Host web-1
HostName 10.0.X.X
ProxyJump monitoring-jump
@onmax
onmax / openrpc-full-after.json
Last active October 10, 2025 06:18
OpenRPC schema comparison for PR #3502
{
"openrpc": "1.2.6",
"info": {
"title": "Nimiq JSON-RPC Specification",
"description": "Through the use of JSON-RPC, Nimiq nodes expose a set of standardized methods and endpoints that allow external applications and tools to interact, stream and control the behavior of the nodes. This includes functionalities such as retrieving information about the blockchain state, submitting transactions, managing accounts, and configuring node settings.",
"version": "1.0.0",
"contact": {
"name": "The Nimiq Core Development Team <[email protected]>",
"email": "",
"url": "https://nimiq.com"
You are an expert in Vue 3, Nuxt 3, TypeScript, Node.js, Vite, Vue Router, Pinia, VueUse, Nuxt UI, and Tailwind CSS. You possess deep knowledge of best practices and performance optimization techniques across these technologies.
Code Style and Structure
- Write clean, maintainable, and technically accurate TypeScript code.
- Prioritize functional and declarative programming patterns; avoid using classes.
- Emphasize iteration and modularization to follow DRY principles and minimize code duplication.
- Always use Composition API with Typescript: `<script setup lang="ts">`.
- Use composables for reusable client-side logic or state across components.
- Prioritize readability and simplicity over premature optimization.
- Leave NO to-do’s, placeholders, or missing pieces in your code.
@onmax
onmax / processByBatches.ts
Created January 26, 2024 04:14
Effective approach to processing items in batches asynchronously in JavaScript. This function processByBatches allows parallel processing of items, with a customizable batch size. There's room for enhancements, like incorporating Promise.allSettled or adding more options. Feedback and improvements are welcome!
interface ProcessByBatchesOptions {
/**
* The number of items to process in parallel.
* @default 10
*/
batchSize?: number
}
async function processByBatches<ItemType, ResultType>(
items: ItemType[],
import data from "./YOUR_JSON.json" assert { type: "json" };
const apiEndpoint = 'https://{SUPABASE_REF}.supabase.co/rest/v1/rpc/upsert_location_with_gmaps_api';
const apiKey = 'API_KEY';
const authorizationBearer = 'YOU AUTH';
const makeRequest = async (data: any[]) => {
const headers = new Headers();
headers.append('Content-Type', 'application/json');
headers.append('apikey', apiKey);
headers.append('Authorization', `Bearer ${authorizationBearer}`);
@onmax
onmax / get_establishment_by_uuid.plpgsql
Last active June 27, 2023 17:32
Postgres functions that power the Crypto Map: map.nimiq.com
CREATE OR REPLACE FUNCTION public.get_establishment_by_uuid(uuid UUID)
RETURNS JSONB AS
$$
DECLARE
result JSONB;
BEGIN
SELECT
json_build_object(
'uuid', e.uuid,
'name', e.name,
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
import "@uniswap/swap-router-contracts/contracts/interfaces/IV3SwapRouter.sol";
import "./interfaces/IERC20Meta.sol";
import "./interfaces/IWrappedChainToken.sol";
import "./BaseCombinedGsnHandler.sol";
abstract contract BaseERC20MetaHandler is BaseCombinedGsnHandler {
@onmax
onmax / nth-rule-unocss.js
Created April 19, 2022 17:21
A custom UnoCSS rule to be able to select items like `nth-2:text-blue` or `nth-9:rounded-9`
import { defineConfig, toEscapedSelector: e } from 'unocss'
// See it in action:
// https://unocss.antfu.me/?html=DwVwNgBAdgLgFgWgEwC4YFMAeMECMwjrTwIDMKuA5ngUZQE4CWAJhAywgMYD2YAzmQgAHMAENO6BIwwBbARNjp6ERH07106KACgIetqKEJMCACwA%2BXRGBhG5gJKyIARmAB6W5b027j9DIgkd08rHwcnUmC7bXdwcyA&config=JYWwDg9gTgLgBAbzgEwKYDNgDtUGEJaYDmANHDBAKIDOAxgIZirIDKqANqrRVAFxyo4AXzjooEEHADkAVywRa1alIBQK1AA9IsFBnoz28NJhz5CwIgAoEKuHCgHU1fgG1bduC4D0APSwwACwAdAFpLIOQAagBKIN5LADoAKmiAEi8yemoATyxaOEsXMmQyKABdMgQoegB3Nk5uaDJaAmoYB25cFhYyIlQcap4haLgAXgA%2BRDh3DzgWrDb7RzG4WvpgeEs%2BgfoeBLB6KGpUABUIAGt%2Byyho6JmPKFQYGSgsOAADVIRUa9r6rh40REkySvH8ARCtACwHYyEsX2QwymXwcnBcAAYyi4AExlERCd73IQVdxlFTDIA&options=N4IgzgLgTglgxhEAuaBXApgXyA
export default defineConfig({
rules: [
[/^nth\-(\d+)\:(.*)$/, async ([, d, r], {rawSelector, constructCSS, generator}) => {
const rule = await (generator.parseToken(r))
return `${e(rawSelector)} > *:nth-child(${d}) { ${rule[0][2]} }`
@onmax
onmax / flatten.js
Created April 9, 2022 13:52
Flatten arry in JS
// https://stackoverflow.com/a/15030117/8312883
function flatten(arr) {
return arr.reduce(function (flat, toFlatten) {
return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten);
}, []);
}
@onmax
onmax / tailwind-only-tooltip.html
Created March 18, 2022 21:18
Tooltip with only Tailwind
<!-- See https://play.tailwindcss.com/PGizn94M2s -->
<div class="min-h-screen bg-gray-50 py-6 flex flex-col justify-center relative overflow-hidden sm:py-12">
<div class="absolute inset-0 bg-[url(/img/grid.svg)] bg-center [mask-image:linear-gradient(180deg,white,rgba(255,255,255,0))]"></div>
<div class="relative px-6 pt-10 pb-8 bg-white shadow-xl ring-1 ring-gray-900/5 sm:max-w-5xl sm:mx-auto sm:rounded-lg sm:px-10">
<div class="max-w-4xl mx-auto">
<div class="divide-y divide-gray-300/50">
<div class="py-8 text-base leading-7 text-gray-600">
<p>
An amazing Tooltip
<span class="group hover:underline cursor-pointer inline-block relative">