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
# Instructions for Using Zero Custom Mutators | |
## Overview | |
Zero Custom Mutators provide a powerful mechanism for defining data write operations beyond simple CRUD. They allow you to embed arbitrary code within your write logic, running both client-side for optimistic updates and server-side for authority and complex operations. | |
**Key Concepts:** | |
- **Arbitrary Code:** Mutators are functions, enabling complex validation, permissions, calling external services (like LLMs or sending emails), calling queue, etc. | |
- **Client-Side Execution:** Mutators run immediately on the client for instant UI feedback. |
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 { Canvas, Circle, Group, Rect, Shader, Skia, useClock, RuntimeShader, SkRuntimeEffect, RoundedRect } from "@shopify/react-native-skia"; | |
import { SafeAreaView, StyleSheet } from "react-native"; | |
import { useDerivedValue, useSharedValue } from "react-native-reanimated"; | |
import { Gesture, GestureDetector, GestureHandlerRootView } from 'react-native-gesture-handler'; | |
const styles = StyleSheet.create({ | |
centered: { | |
flex: 1, | |
alignItems: 'center', | |
justifyContent: 'center', |
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
# Takeout Cursor Rules | |
You are an expert in cross-platform development with React Native, Expo, TypeScript, React, PostgreSQL, Tamagui, Expo Router, tRPC, Solito, Supabase, and more. You possess deep knowledge of best practices and performance optimization techniques across these technologies. Our codebase is a shared Turborepo called "Takeout". | |
• Prompt Context: | |
1. If the question explicitly mentions any of the tools or technologies listed above or pertains to the Takeout codebase, ensure your answer incorporates best practices relevant to the mentioned technologies. | |
2. If the question is about frontend/backend without specific mentions, apply general best practices relevant to the context. | |
3. If the question involves general TypeScript or other unrelated tasks, stick to general best practices. | |
4. For follow-up questions unrelated to the technologies or content specified in these rules, the rules do not apply. Focus on answering the question without considering the specified best practices unless explicit |
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 { createContext as create, useContext } from 'react' | |
export function createContext<T>(initial?: T) { | |
const ctx = create<T>(initial ?? (null as any)) | |
return Object.assign( | |
function Provider(props: React.ComponentProps<typeof ctx.Provider>) { | |
return <ctx.Provider {...props} /> | |
}, | |
ctx, |
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
"use client"; | |
import React, { useEffect, useId, useState } from "react"; | |
import { motion, AnimatePresence, MotionConfig } from "framer-motion"; | |
import { PlusIcon, XIcon } from "lucide-react"; | |
import { createPortal } from "react-dom"; | |
import { cn } from "@/lib/utils"; | |
import { buttonVariants } from "../button"; | |
const transition = { |
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 SwiftUI | |
struct ChatGPTTextField: View { | |
// MARK: - State | |
/// State to hold our `TextField` query. | |
@State private var queryMessage: String = "" | |
/// Focus state for our `TextField`. |
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 ExpoModulesCore | |
import SwiftUI | |
public class SwiftuiViewModule: Module { | |
public func definition() -> ModuleDefinition { | |
Name("SwiftuiForm") | |
View(SwiftuiView.self) { | |
Prop("name") { (view, name: String) in | |
view.name = name | |
} |
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 axios from 'axios' | |
import { useOptimisticMutation } from "./useOptimisticMutation.ts" | |
type Response = boolean | |
type Error = unknown | |
type MutationVariables = {itemId: string} | |
type Items = {id: string; name: string}[] | |
type Likes = {itemId: string}[] | |
type History = {type: string}[] |
NewerOlder