Skip to content

Instantly share code, notes, and snippets.

View waspeer's full-sized avatar
🏠
Working from home

Wannes Salomé waspeer

🏠
Working from home
  • Rotterdam, the Netherlands
View GitHub Profile
import createImageUrlBuilder from '@sanity/image-url';
// import { sanityClient } from 'sanity:client';
import createClient from 'picosanity';
import { z } from 'zod';
const sanityClient = createClient({
dataset: 'production',
projectId: 'maa8c2eu',
apiVersion: '2024-04-29',
useCdn: import.meta.env.PROD,
const arr1 = [
['name', 'id', 'age', 'weight'],
['Susan', '3', '20', '120'],
['John', '1', '21', '150'],
['Bob', '2', '23', '90'],
['Ben', '4', '20', '100'],
];
const arr2 = [
['name', 'id', 'height'],
import { defineDocument } from 'sanity-typed-queries';
const { section } = defineDocument(
'section',
{
name: {
type: 'string',
title: 'Name',
validation: (Rule) => Rule.required(),
},
/**
/* An attempt to make the error handling process described on Khalil Stemmler's excellent
/* blog a little somewhat simpler.
/* https://khalilstemmler.com/articles/enterprise-typescript-nodejs/functional-error-handling/
/**
// Left and Right classes, but more specific to error handling.
class Failure<L, A = any> {
readonly error: L;