Skip to content

Instantly share code, notes, and snippets.

@mtt87
mtt87 / _middleware.ts
Created December 21, 2021 14:39
Add password protection to any Vercel website, save $150/month.
import { addYears } from 'date-fns'
import { NextRequest, NextResponse } from 'next/server'
function middleware(req: NextRequest) {
if (req.nextUrl.pathname.startsWith('/api')) {
return NextResponse.next()
}
if (process.env.VERCEL_ENV !== 'preview') {
return NextResponse.next()
@mtt87
mtt87 / setup.md
Created March 5, 2023 16:06
Philips Hue Sync box issues

Setup before

LG OLED55C14LB (4k resolution)

  • HDMI1 PS5
  • HDMI2 (eARC enabled) AppleTV 4k latest gen ethernet

I also have 2x HomePods gen2 connected to AppleTV Both cables are HDMI 2.1 8k certified cable, and I can watch Dolby Vision content without any issues, hear sound with no issues and since eARC is enabled on the AppleTV I can hear the sound of PS5 through the HomePods when I play games.

Setup after adding Hue sync box + Hue smart light gradient for 55" tv

Following this discussion on Twitter https://twitter.com/mattia_asti/status/1645517258926575616 I found out that the current pattern we are using for react-query custom hooks is bad.

// BAD
function useAnimalsBad() {
  const { data, isFetching, refetch } = useQuery<Animal[]>(
    ["animals-bad"],
    () => getAnimals()
  );