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 { useQueryClient } from '@tanstack/react-query'; | |
/* | |
* Demonstration of how to fetch data from API in a promise, | |
* but utilizing already cached data from React Query | |
* or (if not present) populate the cache after fetch. | |
* | |
* Motivation: reduce unnecessary data fetching. | |
*/ |
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
{ | |
"name": "Notification app", | |
"short_name": "Notifs", | |
"start_url": ".", | |
"display": "standalone", | |
"background_color": "#1f2937", | |
"orientation": "portrait", | |
"description": "Notifications made easy.", | |
"icons": [{ | |
"src": "img/logo_144.png", |
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
export const authOptions: NextAuthOptions = { | |
// [...other options] | |
providers: [ | |
env.NODE_ENV === "development" | |
? ConsoleOtpProvider() | |
: EmailOtpProvider({ from: env.EMAIL_FROM, server: env.EMAIL_URL }), | |
], | |
}; |
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 { type NextAuthOptions } from "next-auth"; | |
import EmailProvider from "next-auth/providers/email"; | |
import { ConsoleEmailLink } from "./dev.auth.ts"; | |
/** | |
* ConsoleEmailLink will print a login link to the console. | |
* Enables you to login while developing without internet, | |
* and makes local setup easier. | |
*/ |
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
describe('matchesPath', () => { | |
const matches = [ | |
['/cake', '/cake'], | |
['/cake', '/cake/'], | |
['/cake', '/cake?frige=warm'], | |
['/cake', '/cake?frige=warm&freezer=cold'], | |
['/[id]', '/cake'], | |
['/[anything-goes]', '/cake'], | |
['/c/[id]/practitioner/[pid]/[anything-goes]', '/c/1/practitioner/2/3'], | |
['/[...rest]', '/cake'], |
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
// autogenerated from Lago database model (https://github.com/getlago/lago) | |
generator client { | |
provider = "prisma-client-js" | |
} | |
datasource db { | |
provider = "postgresql" | |
url = env("DATABASE_URL") | |
} |
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
{ | |
"slides": "https://docs.google.com/presentation/d/1WyicsfMJirQDpJYTVOFwRxwiwgfAVq6fRyylFXc6_G4/edit?usp=sharing", | |
"date": "September 2012" | |
} |
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
/* | |
jscodeshift transform: adds the '.js' extension | |
to all import declarations with relative specifiers: | |
From './file' to './file.js', and | |
from '../file' to '../file.js'. | |
*/ | |
module.exports = function (fileInfo, api) { |
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
/* | |
* Walks a directory (fs.readdir but recursively) | |
* Context: | |
* - fs does not have support for walk/readdir recursively | |
* - fs-extra moved "walk" functionality to https://github.com/jprichardson/node-klaw | |
*/ | |
export const listDirectory = async ( | |
currentPath: string, | |
includeDirectories = false, |
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
/** | |
* Usage node generate-story.js [path] | |
* | |
* Example (generate stories for all components in folder "components": | |
* node generate-story.js ./src/components | |
*/ | |
const fs = require('fs'); | |
const SUPPORTED_FILE_EXT = ['tsx', 'jsx']; | |
const EXCLUDED_FILES = []; |
NewerOlder