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
find app/src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \; |
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
# rename all .js to .mjs | |
for f in **/*.js; do mv -- "$f" "${f%.js}.mjs"; done | |
# add .mjs to all file-based import statements* | |
find . -type f -name "*.mjs" -exec sed -i '' -E "s/(import.+'\.[a-zA-Z0-9\.\/-]+)';/\1\.mjs';/g" {} \; | |
# *NOTES: | |
# 1. This will double up existing .mjs extension in imports. | |
# Couldn't get phrase negation working in this sed substitution regex :( | |
# |
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
const isItIntrospectionQuery = (query: string): boolean => { | |
return query.includes('IntrospectionQuery') | |
} | |
const postgraphileOptions = { | |
async pgSettings(req: Request) { | |
if (isItIntrospectionQuery(JSON.stringify(req.body))) return {} | |
return { | |
role: 'DATABASE_VISITOR', |
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 React from 'react'; | |
import Router, { NextRouter } from 'next/router'; | |
// Save the scroll position for the given url | |
function saveScrollPosition( | |
url: string, | |
element: HTMLElement, | |
savePosition: (url: string, pos: number) => void | |
) { |
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
# Requires the GitHub Copilot CLI from GitHub Next | |
# https://www.npmjs.com/package/@githubnext/github-copilot-cli#installation-and-setup | |
# This needs to be set up as a function in your fish config. You can use `funced -s q` to do this. | |
# Options: | |
# q -g --git: Use github-copilot-cli git-assist | |
# q -h --gh: Use github-copilot-cli gh-assist | |
# Defaults to using what-the-shell (general command assist) if neither option is provided | |
# Completions for your Fish config: |
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
declare global { | |
namespace GraphileBuild { | |
interface PgCodecTags { | |
// This enables TypeScript autocomplete for our @group smart tag | |
group?: string | string[]; | |
} | |
interface Inflection { | |
// Our inflector to pick the name of the grouped type, e.g. `User` table | |
// type, and `address` group might produce `UserAddress` grouped type name | |
groupedTypeName(details: { |