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, { useState } from "react" | |
import { TextInput, Stack } from "@sanity/ui" | |
import { set, unset } from "sanity" | |
interface LinkedInEmbed { | |
_key: string | |
_type: string | |
postUrl: string | |
height: number | |
} |
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 { toPlainText } from "@portabletext/react" | |
import { BlockEditor as DefaultBlockEditor } from "sanity" | |
import { handlePaste } from "~/studio/components/blockEditor/handlePaste" | |
const wordsPerMinute = 200 | |
export default function BlockEditor(props: any, ref) { | |
const value = props.value ?? [] | |
const plainText = toPlainText(value) | |
const characterCount = plainText.length |
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 { redirect } from "next/navigation" | |
import { createClient } from "next-sanity" | |
const client = createClient({ | |
apiVersion: "vX", | |
dataset: process.env.NEXT_PUBLIC_SANITY_DATASET, | |
projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID, | |
token: process.env.SANITY_WRITE_TOKEN, | |
useCdn: true, | |
}) |
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
// Try it out here: https://groq.dev/iZPFWScPZXANqgFGQgoUH2 | |
*[_type == "post"]{ | |
..., | |
// join into an array of just the titles | |
"categoryTitles": categories[]->title, | |
// join the completedocuments | |
"categoryDocs": categories[]->, | |
// join and project specific fields | |
categories[]->{ |
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 {defineConfig, type Role} from 'sanity' | |
import {deskTool} from 'sanity/desk' | |
import {visionTool} from '@sanity/vision' | |
import {schemaTypes} from './schemas' | |
export const EDITOR_TYPES = ['post'] | |
const isAdmin = (roles: Role[]) => !roles?.find(({name = ''}) => name === 'administrator') | |
export default defineConfig({ |
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
/* Remember: | |
sanity install @sanity/code-input | |
yarn add micromark | |
*/ | |
import { micromark } from 'micromark' | |
import { htmlToBlocks } from '@sanity/block-tools' | |
export async function handlePaste(input) { | |
const { event, type, path } = input | |
const text = event.clipboardData.getData('text/plain') |
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
/** | |
* Retrieves all the rows in the active spreadsheet that contain data and logs the | |
* values for each row. | |
* For more information on using the Spreadsheet API, see | |
* https://developers.google.com/apps-script/service_spreadsheet | |
*/ | |
function readRows() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var rows = sheet.getDataRange(); | |
var numRows = rows.getNumRows(); |
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
#!/bin/bash | |
# Assumes that you have the Netlify and jq CLI tools installed and that you are logged in. | |
# Only been tested on macOS and zsh | |
# Will change the build image for all sites in a Netlify account to the specified image | |
# | |
# Usage: sh ./netlify-build-image-bulk.sh | |
# This assumes that you have logged in with the CLI fairly recently and that you're on macOS | |
# For other systems: https://github.com/sindresorhus/env-paths#pathsconfig | |
NETLIFY_AUTH=$(cat ~/Library/Preferences/netlify/config.json|jq -r ".users[].auth.token") |
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
<!-- resources/views/posts.blade.php --> | |
<!DOCTYPE html> | |
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Laravel</title> | |
<!-- Fonts --> |
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
<HEADER> | |
<TITLE>The World Wide Web project</TITLE> | |
<NEXTID N="55"> | |
</HEADER> | |
<BODY> | |
<H1>World Wide Web</H1>The WorldWideWeb (W3) is a wide-area<A | |
NAME=0 HREF="WhatIs.html"> | |
hypermedia</A> information retrieval | |
initiative aiming to give universal |
NewerOlder