Skip to content

Instantly share code, notes, and snippets.

@marr
marr / form.vue
Last active February 27, 2025 19:29
requires dependency not working
<script setup lang="ts">
import { z } from 'zod';
import { DependencyType} from '@/components/ui/auto-form/interface';
const compressorType = z.enum(["Axial", "Centrifugal", "Reciprocating", "Screw"], {
message: "Invalid compressor type",
});
const compressorSealType = z.enum(["RPV", "DSV", "WSV"], {
message: "Invalid compressor seal type",
});
<script setup lang="ts">
import { computed, ref, watch } from "vue";
import {
ComboboxInput,
ComboboxRoot,
useFilter,
} from "reka-ui";
import { Icon } from "@iconify/vue";
const { contains } = useFilter({ sensitivity: "base" });
<script setup lang="ts">
import { cn } from "@/lib/utils";
import { Check, ChevronsUpDown } from "lucide-vue-next";
import { useField } from "vee-validate";
const {
name,
placeholder = "Choose an option...",
disabled,
options = [],
} = defineProps<{
@marr
marr / i18n-v8.json
Created February 14, 2025 18:43
Workign vs nonworking tsconfig
// Generated by nuxi
{
"compilerOptions": {
"paths": {
"nitropack/types": [
"../node_modules/nitropack/types"
],
"nitropack/runtime": [
"../node_modules/nitropack/runtime"
],
@marr
marr / launch.json
Created March 5, 2023 14:10
Fullstack Debugging nuxt@2 with VS Code
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "client: chrome",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}",
"userDataDir": false,
@marr
marr / repro.mjs
Last active February 10, 2023 02:59
import { ofetch } from "../dist/node.mjs";
let body;
body = { x: 1 }; // request body is "[object Object]"
// body = JSON.stringify(body); // request body is correctly received
const url ='https://d0348819-d0b4-4913-b739-360dfe6e0eef.mock.pstmn.io/debug';
const response = await ofetch(url, { body, method: "PATCH" });
console.log(response);
<template>
<div>
<label class="block text-sm font-medium text-gray-700" :for="name">{{
label
}}</label>
<div class="mt-1 rounded-md shadow-sm">
<input
:class="classes"
:id="id || name"
:name="name"
@marr
marr / machine.js
Last active January 24, 2022 18:00
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
function fetchWithTimeout( url, timeout ) {
return new Promise( (resolve, reject) => {
// Set timeout timer
let timer = setTimeout(
() => reject( new Error('Request timed out') ),
timeout
);
fetch( url ).then(
response => resolve( response ),
const controller = new AbortController()
const signal = controller.signal
setTimeout(() => {
controller.abort()
}, 1000)
fetch(url, { signal })