This file contains hidden or 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
| function createStore<T = unknown>(initial?: T) { | |
| type Subscriber = (state: T) => void | |
| let previous: T | |
| let current: T | |
| let _subscriber: Subscriber | |
| if (initial) current = initial | |
| const update = (state: T) => { | |
| previous = current |
This file contains hidden or 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 { APIGatewayProxyEventV2 } from "aws-lambda" | |
| import busboy from "busboy" | |
| // https://github.com/francismeynard/lambda-multipart-parser/blob/master/index.js | |
| async function parseUrlEncodedFormEvent<T>( | |
| event: APIGatewayProxyEventV2, | |
| ): Promise<T> { | |
| return new Promise((resolve, reject) => { | |
| const fields: Record<string, unknown> = {} | |
| const bb = busboy({ headers: event.headers }) |
This file contains hidden or 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 { PropsWithChildren } from "react" | |
| import { useState, createContext, useEffect, useContext } from "react" | |
| import { useAuthenticator } from "@aws-amplify/ui-react" | |
| import { fetchUserAttributes } from "aws-amplify/auth" | |
| type UserProfile = { | |
| /** | |
| * the sub | |
| */ | |
| id: string |
This file contains hidden or 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
| vim.api.nvim_set_keymap('n', '<SPACE>', '<NOP>', { noremap = true }) | |
| vim.g.mapleader = " " | |
| if vim.g.vscode then | |
| require("vscode_amplify_docs_fold_filters_commands") | |
| -- VSCode extension | |
| local vscode = require('vscode-neovim') | |
| -- set vscode as default notifier | |
| vim.notify = vscode.notify | |
| -- amplify docs filters |
This file contains hidden or 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 { DsqlSigner } from "@aws-sdk/dsql-signer" | |
| import { drizzle } from "drizzle-orm/node-postgres" | |
| import pg from "pg" | |
| const { Client } = pg | |
| const id = "<your-database-id>" as const | |
| const endpoint = `${id}.dsql.us-east-1.on.aws` as const | |
| const region = "us-east-1" as const |
OlderNewer