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
interface ExampleComponentProps { | |
profileId: string; | |
} | |
function ExampleComponent({ profileId }: ExampleComponentProps) { | |
const profileQuery = queries.profileService.getProfile.useQuery({ | |
profile_id: profileId, | |
}); | |
const recipesQuery = queries.recipeService.findRecipes.useQuery({ | |
recipe_ids: [], |
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
"use client"; | |
import { cn } from "@/lib/utils"; | |
import { CodeHighlightNode, CodeNode } from "@lexical/code"; | |
import { AutoLinkNode, LinkNode } from "@lexical/link"; | |
import { ListItemNode, ListNode } from "@lexical/list"; | |
import { TRANSFORMERS } from "@lexical/markdown"; | |
import { LexicalComposer } from "@lexical/react/LexicalComposer"; | |
import { ContentEditable } from "@lexical/react/LexicalContentEditable"; | |
import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary"; |
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 { cn } from "@/lib/utils"; | |
import dayjs from "dayjs"; | |
import customParseFormat from "dayjs/plugin/customParseFormat"; | |
import { CalendarIcon } from "lucide-react"; | |
import { useState } from "react"; | |
import { Button } from "./button"; | |
import { Calendar } from "./calendar"; | |
import { Popover, PopoverContent, PopoverTrigger } from "./popover"; | |
import { | |
Select, |
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 { useState } from "react"; | |
import z, { ZodSchema } from "zod"; | |
import { destroy, post, put } from "./fetch"; | |
export type ApiResource<I> = { | |
path: string; | |
method: "POST" | "PUT" | "DELETE"; | |
inputSchema: I; | |
outputSchema: ZodSchema; | |
}; |
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 z, { ZodSchema } from 'zod'; | |
// GET as json and returns typed response | |
export async function get<T extends ZodSchema>(path: string, schema: T, config?: RequestInit) { | |
const res = await fetch(path, config); | |
return handleResponse(res, schema); | |
} | |
export async function post<T extends ZodSchema, R extends ZodSchema>( |
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
1. npx create-next-app@latest --typescript | |
2. Add devDependencies - ngrok, prettier, concurrently, "concurrently \"next dev\" \"npm run ngrok\" --prefix none" | |
3. https://ui.shadcn.com/docs/installation/next | |
4. Copy .vscode/settings , `npx prettier . --write` | |
5. Add `.env`, add them to .gitignore | |
6. `npx shadcn-ui@latest add button dialog select form dropdown-menu` |
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 { ChatOpenAI } from 'langchain/chat_models/openai'; | |
import { HumanChatMessage } from 'langchain/schema'; | |
import { ZodSchema, z } from 'zod'; | |
import zodToJsonSchema from 'zod-to-json-schema'; | |
import { winstonLogger } from '../winston'; | |
const logger = winstonLogger.child({ service: 'AIService' }); | |
const chatOpenAIModel = new ChatOpenAI({ | |
temperature: 0, |
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 'package:flutter/material.dart'; | |
import 'package:flutter_riverpod/flutter_riverpod.dart'; | |
void main() => runApp(ProviderScope(child: MyApp())); | |
class MyApp extends ConsumerWidget { | |
@override | |
Widget build(BuildContext context, WidgetRef ref) { | |
final request = getVendorsForCollectionFutureProvider('123'); | |
final asyncResult = ref.watch(request); |
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
{ | |
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and | |
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope | |
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is | |
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. | |
// Placeholders with the same ids are connected. | |
// Example: | |
// "Print to console": { | |
// "scope": "javascript,typescript", |
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
1. Create new EC2 Security group with the following rules: | |
INBOUND - HTTP / `0.0.0.0/0, ::/0` | |
INBOUND - HTTPS / `0.0.0.0/0, ::/0` | |
OUTBOUND - All Traffic | |
2. Create new application load balancer | |
- Listeners: HTTP, HTTPS | |
- Select same availablity zones as your lambda | |
- Choose ACM certificate that you issued for domain | |
- Use previously created security group |
NewerOlder