Skip to content

Instantly share code, notes, and snippets.

View DorielRivalet's full-sized avatar
🎯
Focusing

Doriel Rivalet DorielRivalet

🎯
Focusing
  • Argentina
View GitHub Profile
@sandengocka
sandengocka / local-development-clerk-supabase.md
Last active January 11, 2025 23:30
Bridging External Auth with Supabase Studio's User Impersonation

Bridging External Auth with Supabase User Impersonation

As promised, here’s a write up on how I integrated Clerk authentication with Supabase Studio’s user impersonation feature for local development. I drafted it as a mini “how-to” guide, and while writing it, I realized there might be a simpler solution on Supabase’s end to handle this more gracefully...more on that at the end! 😀

This gist is split into two main sections:

  • Section 1: A guide to bridging Clerk and Supabase Studio impersonation locally
  • Section 2: A proposed enhancement to Supabase Studio's impersonation mode to more elegantly solve the same problem for all environments

Section 1: A Guide to Bridging Clerk and Supabase Studio Impersonation Locally

@ikupenov
ikupenov / db-client.ts
Created February 29, 2024 18:40
Intercepting Drizzle db calls
import { and, type DBQueryConfig, eq, type SQLWrapper } from "drizzle-orm";
import { drizzle } from "drizzle-orm/postgres-js";
import postgres, { type Sql } from "postgres";
import { type AnyArgs } from "@/common";
import {
type DbClient,
type DbTable,
type DeleteArgs,
@mvandermeulen
mvandermeulen / readme.md
Created December 31, 2023 17:12 — forked from rphlmr/readme.md
Use Supabase RLS with Drizzle

Supabase RLS Policy functions and Postgres transaction configuration association

source

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
@fnimick
fnimick / supabase_profile_sync.sql
Last active August 19, 2025 22:40
Create a `public.profile` table and keep it in sync with supabase `auth.users` for selected fields in both directions.
/**
* USERS
* Note: This table contains user data. Users should only be able to view and update their own data.
* Some data is synced back and forth to `auth.users` as described below.
*
* `full_name`: synced in both directions
* `email`: synced from user metadata to profile only
* `avatar_url`: synced from user metadata to profile only
* `terms_accepted_at`: synced from profile to user metadata only
*/
@ky28059
ky28059 / vercel.md
Last active February 6, 2026 14:27
Deploying to Vercel from an organization for free using GitHub actions

This gist was partially inspired by this blog about Next.js Vercel CI with GitHub actions.

The problem

An easy way to deploy and host websites for free is to use GitHub pages. If you've deployed a Next.js project to GitHub pages, you may have used a GitHub action similar to this in the past to automatically redeploy the site when a new commit is pushed:

# gh-pages-merge.yml
name: Deploy to gh-pages on merge
on:
  push:
@thecodeboss
thecodeboss / prisma-slonik-usage.ts
Created July 22, 2022 22:01
Prisma/Slonik Usage Example
import { PrismaClient } from '@prisma/client';
import type { User } from '@prisma/client';
import { createPool, sql } from 'slonik';
export const buildBaseConnectionURL = (config) => {
return (
'postgresql://' +
config.DB_USER +
':' +
config.DB_PASS +
@gillescastel
gillescastel / Phd workflow.md
Last active August 24, 2025 02:48
Phd Workflow

Directory structure:

.
├── papers
│   ├── Title - Author.pdf
│   └── Title - Author.pdf
├── notes
│   ├── 2022-04-10
│   │   ├── note.tex
@jcubic
jcubic / cdn.md
Last active January 26, 2026 14:01
How to setup a literally free CDN
@PiN73
PiN73 / !.md
Last active April 22, 2025 03:04
WPF ScrollViewer virtualization AND smooth scroll. Full: https://github.com/PiN73/TestScrollVirtualization/

By default, <ItemsControl>/<ScrollViewer> doesn't use virtualization. All its items are rendered at once. This causes lags/freezing on first render and each re-render (for example, if list data or window size changes).

Adding ScrollViewer.CanContentScroll="True" will enable virtualization and make loading fast. But the list will be scrolled one whole item a time, which feels like jumping if items height is big enough.

To make virtualization enabled and keep smooth scrolling, add also VirtualizingPanel.ScrollUnit="Pixel"