Skip to content

Instantly share code, notes, and snippets.

View sandros94's full-sized avatar
💾

Sandro Circi sandros94

💾
View GitHub Profile
# Drupal
/vendor/
/web/core
/web/libraries
/web/modules/contrib
/web/profiles/contrib
/web/themes/contrib
/web/sites/simpletest
/web/sites/*/files
/web/sites/*/private
@sandros94
sandros94 / fetch-cdn.ts
Created October 14, 2025 18:42
Wrappers around useFetch and useLazyFetch that automatically sets the baseURL to the CDN URL defined in the runtime config.
/**
* Version: 1.0.0
* Nuxt: 4.1.x
* @license MIT
* @host https://gist.github.com/sandros94/fc7c62326e807a35bc4647247e8d1aea
*
* Wrappers around useFetch and useLazyFetch that automatically sets the baseURL to the CDN URL defined in the runtime config.
*/
/* eslint-disable @typescript-eslint/no-invalid-void-type */
@sandros94
sandros94 / valibot-utils.ts
Last active September 17, 2025 09:28
Schema utilities for valibot
// valibot-utils v0.3.0
// https://gist.github.com/sandros94/804aee5dc14a3bb394b3279f74c32cee
import type {
ArraySchema,
ArraySchemaAsync,
ErrorMessage,
GenericSchema,
GenericSchemaAsync,
InferIssue,
@sandros94
sandros94 / impossible.ts
Created August 3, 2025 02:02
Impossible array type interface
interface Brand<T extends string = string> {
name: T
cb: (nameUsed: T) => T;
};
// This works
function single<T extends string>(
brand: Brand<T>,
) {
@sandros94
sandros94 / docker-compose.neon.yml
Last active March 9, 2025 14:57
Neon Proxy with Coolify
# documentation: https://neon.tech
# slogan: The database you love, on a serverless platform designed to help you build reliable and scalable applications faster.
# tags: proxy, neon, postgresql
# port: 80, 2112
services:
neon-proxy:
image: 'ghcr.io/neondatabase/wsproxy:latest'
environment:
- SERVICE_FQDN_NEONPROXY
@sandros94
sandros94 / monaco-editor.vue
Last active January 16, 2025 17:22
An example for loading a Monaco Editor using Nuxt Script
<script setup lang="ts">
import { useScript } from '@unhead/vue'
import { computed, ref, createError, onMounted, watch, useTemplateRef } from '#imports'
const MONACO_CDN_BASE = 'https://unpkg.com/[email protected]/min/'
const MDC_CDN_BASE = 'https://cdn.jsdelivr.net/npm/@nuxtlabs/[email protected]/'
declare global {
interface Window {
require: any
@sandros94
sandros94 / nuxt-drizzle-studio.ts
Last active December 3, 2024 16:16
Integrate Drizzle Studio in Nuxt's DevTools
import { consola } from 'consola'
import { defineNuxtModule } from 'nuxt/kit'
import { addCustomTab, startSubprocess } from '@nuxt/devtools-kit'
export default defineNuxtModule({
meta: {
name: 'drizzle',
configKey: 'drizzle',
},
@sandros94
sandros94 / nixpacks.toml
Last active September 10, 2025 14:02
A collection of nixpacks.toml to be used with Nuxt
# Nuxt's build nixpacks.toml
[variables]
NIXPACKS_NODE_VERSION = '20'
[phases.install]
onlyIncludeFiles = [
".npmrc",
"package.json",
"pnpm-lock.yaml",
@sandros94
sandros94 / customFetch.ts
Last active September 14, 2024 00:04
How to create a custom implementation of Nuxt's useFetch
// ./app/plugins/customFetch.ts
import { ofetch } from 'ofetch'
export default defineNuxtPlugin(() => {
const customFetch = ofetch.create({
baseURL: 'https://directus.pizza',
})
return {
provide: {
@sandros94
sandros94 / .dockerignore
Last active September 12, 2025 07:58
Nuxt dedicated Dockerfiles
# .dockerignore - v1.4.2
# https://gist.github.com/sandros94/03675514546f17af1fd6db3863c043b4
# Nuxt dev/build outputs
.output
.nuxt
.nitro
.cache
.data