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
FROM postgres:15.3 | |
RUN apt update && apt upgrade -y | |
RUN apt install -y git build-essential postgresql-server-dev-15 | |
# Copy in files from ph_embedding dir | |
RUN git clone https://github.com/neondatabase/pg_embedding.git | |
RUN cd pg_embedding && make && make install |
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 * as React from 'react' | |
import {StringInputProps, useClient, useFormValue} from 'sanity' | |
export const ReadOnlyIfPublished = (props: StringInputProps) => { | |
const client = useClient({ apiVersion: '2021-03-25', }) | |
const docId = useFormValue(['_id']) as string | |
const createdAt = useFormValue(['_createdAt']) | |
const [readOnly, setReadOnly] = React.useState(createdAt !== undefined) |
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 {useHasDocumentPermissionInDataset} from './useHasDocumentPermissionInDataset' | |
export function MyReactComponent() { | |
const targetDataset = 'playground' | |
const hasGrant = useHasDocumentPermissionInDataset({ | |
dataset: targetDataset, | |
permission: 'update', | |
documentStub: {_type: 'provide-me', _id: 'provide-me'}, | |
}) |
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
// Example of how to patch documents in a dataset with data from another dataset | |
// using the Sanity client and transactions. More info: https://www.sanity.io/docs/transactions | |
import {createClient} from '@sanity/client' | |
// The 'from' dataset | |
const source = createClient({ | |
projectId: 'rwmuledy', | |
dataset: 'production', | |
useCdn: false, | |
token: 'skseugwsW...', |
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 algoliasearch from "algoliasearch"; | |
import { createClient, SanityDocumentStub } from "@sanity/client"; | |
import { Handler } from "@netlify/functions"; | |
import indexer from "sanity-algolia" | |
const algolia = algoliasearch( | |
"application-id", | |
process.env.ALGOLIA_ADMIN_API_KEY | |
); |
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 * as React from 'react' | |
import {definePlugin, SanityClient, useClient, useSchema} from 'sanity' | |
import type {Tool} from 'sanity' | |
import {Card, Stack, Grid, Checkbox, Flex, Box, Text, Heading, Button} from '@sanity/ui' | |
import {useEffect} from 'react' | |
type ToolProps = { | |
tool: Tool | |
} |
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": "article", | |
"type": "document", | |
"title": "Article", | |
"fields": [ | |
{ | |
"type": "string", | |
"name": "title" | |
}, | |
{ |
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 { assert } from "console" | |
import { open } from "fs/promises" | |
const strEncoder = new TextDecoder("utf-8") | |
function readString(scanner: DataView, cursor: number, len: number) { | |
const bytes = [] | |
for (let i = 0; i < len; i++) { | |
bytes[i] = scanner.getUint8(cursor++) | |
} | |
const a = new Uint8Array(bytes) |
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 { useCallback, useEffect } from "react"; | |
import type { SanityClient, SanityDocument } from "@sanity/client"; | |
import {nanoid} from "nanoid" | |
type Params<T> = { | |
id: string; | |
client: SanityClient; | |
handler: (from: string, payload: T) => Promise<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
[ | |
"aahed", | |
"aalii", | |
"aargh", | |
"aarti", | |
"abaca", | |
"abaci", | |
"abacs", | |
"abaft", | |
"abaka", |
NewerOlder