Supabase's RLS Policy functions | PgTransaction config to set | Description |
---|---|---|
auth.uid() |
set_config('request.jwt.claim.sub', <current_user_uid>, true) |
<current_user_uid> comes from your own way to get the current user uid |
auth.email() |
set_config('request.jwt.claim.email', <current_user_email>, true) |
<current_user_email> The current user email |
auth.role() |
set_config('request.jwt.claim.role', <current_user_role>, true) |
<current_user_role> The current user role |
auth.jwt() |
set_config('request.jwt.claim', <current_user_jwt>, true) |
<current_user_jwt> The current user jwt token. 🚨 I'm note sure about the config name, found nothing in Supabase repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# See https://fly.io/docs/reference/configuration/ for information about how to use this file. | |
# | |
app = "my-app" | |
primary_region = "cdg" | |
kill_signal = "SIGINT" | |
kill_timeout = "5s" | |
swap_size_mb = 256 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* -------------------------------------------------------------------------- */ | |
/* More here; */ | |
/* -------------------------------------------------------------------------- */ | |
//gist.github.com/rphlmr/0d1722a794ed5a16da0fdf6652902b15 | |
https: export function distinctOn<Column extends AnyColumn>(column: Column) { | |
return sql<Column["_"]["data"]>`distinct on (${column}) ${column}`; | |
} | |
export function jsonBuildObject<T extends SelectedFields>(shape: T) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* App Install Manager | |
* | |
* Author: @rphlmr | |
*/ | |
/** | |
* You will be surprised by the code below. | |
* | |
* `beforeinstallprompt` is an event really hard to work with 😵💫 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getSession, session } from "remix-hono/session"; | |
import { pathToRegexp } from "path-to-regexp"; | |
/** | |
* Add protected routes middleware | |
* | |
*/ | |
app.use( | |
protect({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RED="\e[31m" | |
ENDCOLOR="\e[0m" | |
echo "⏳ Checking for type errors..." | |
# Run tsc and capture the output | |
TYPE_ERRORS=$(tsc --project ./tsconfig.json 2>&1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createId } from "@paralleldrive/cuid2"; | |
/** | |
* @param message The message intended for the user. | |
* | |
* Other params are for logging purposes and help us debug. | |
* @param cause The error that caused the rejection. | |
* @param context Additional data to help us debug. | |
* @param name A name to help us debug and filter logs. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { faker } from "@faker-js/faker"; | |
import { Suspense, cache } from "react"; | |
import Link from "next/link"; | |
export const dynamic = "force-dynamic"; | |
export const revalidate = 0; | |
const salesFromDB = Array.from( | |
{ length: 21 }, | |
() => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* By default, Remix will handle generating the HTTP Response for you. | |
* You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨ | |
* For more information, see https://remix.run/file-conventions/entry.server | |
*/ | |
import crypto from "node:crypto"; | |
import { PassThrough } from "node:stream"; | |
import type { EntryContext } from "@remix-run/node"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Remember to install mini-svg-data-uri | |
// Follow me on twitter for memes @jordienr | |
import { type Config } from "tailwindcss"; | |
const { | |
default: flattenColorPalette, | |
} = require("tailwindcss/lib/util/flattenColorPalette"); | |
const svgToDataUri = require("mini-svg-data-uri"); | |
export default { |
NewerOlder