Skip to content

Instantly share code, notes, and snippets.

View PaulieScanlon's full-sized avatar

Paul Scanlon PaulieScanlon

View GitHub Profile
@PaulieScanlon
PaulieScanlon / .env
Created April 25, 2024 19:34
DATABASE_URL in .env
// .env
DATABASE_URL="postgresql://..."
@PaulieScanlon
PaulieScanlon / package.json
Created April 25, 2024 19:33
kysely-generate script
// package.json
"scripts": {
...
"kysely-generate": "kysely-codegen --out-file ./kysely-db.d.ts",
},
@PaulieScanlon
PaulieScanlon / .sh
Created April 25, 2024 19:32
npm install script kysely-codegen
npm install --save-dev kysely-codegen
@PaulieScanlon
PaulieScanlon / .sh
Created April 25, 2024 19:31
npm install script kysely and pg
npm install kysely pg
@PaulieScanlon
PaulieScanlon / query.js
Created April 25, 2024 19:28
Example of Xata JavaScript query
xata.db['users'].select(['first_name', 'country', 'email']).getMany();
@PaulieScanlon
PaulieScanlon / query.js
Created April 25, 2024 19:27
Example of Supabase JavaScript query
supabase.from('users').select('first_name, country, email');
@PaulieScanlon
PaulieScanlon / query.js
Created April 25, 2024 19:26
Example of SQL query
client.query('SELECT first_name, country, email FROM users');
@PaulieScanlon
PaulieScanlon / query.js
Created April 25, 2024 19:20
Example of Supabase JavaScript query
supabase.from('users').select();
@PaulieScanlon
PaulieScanlon / primitive-toggle-local-storage.tsx
Created April 22, 2024 21:18
Example local storage component
// src/components/primitive-toggle-local-storage.tsx
'use client';
import { useAtom } from 'jotai';
import { darkModeAtom } from '../state';
export const PrimitiveToggleLocalStorage = () => {
const [darkMode, setDarkMode] = useAtom(darkModeAtom);
@PaulieScanlon
PaulieScanlon / index.diff
Created April 22, 2024 21:17
Example of state
// src/state/index.ts
import { atom } from 'jotai';
+ import { atomWithStorage } from 'jotai/utils';
export const countAtom = atom(0);
export const objectAtom = atom({
foo: 'bar',
test: true,