Skip to content

Instantly share code, notes, and snippets.

View ulises-codes's full-sized avatar

Ulises Himely ulises-codes

View GitHub Profile
@ulises-codes
ulises-codes / mergeSort.ts
Created March 12, 2021 01:34
A simple implementation of a merge sort algorithm.
function mergeSort(arr: number[]): number[] {
const length = arr.length;
if (length === 1) return arr;
const middle = Math.floor(length / 2);
const left = arr.slice(0, middle);
const right = arr.slice(middle, length);
@ulises-codes
ulises-codes / SanityImageLoader.ts
Last active February 21, 2024 16:44
Custom Sanity loader for Next JS Image component.
import Image, { ImageProps } from 'next/image';
import { imageBuilder } from './sanity';
import type { SanityImageSource } from '@sanity/image-url/lib/types/types';
interface MyImageProps extends Omit<ImageProps, 'src'> {
src: SanityImageSource;
quality?: number;
blur?: number;
}