Skip to content

Instantly share code, notes, and snippets.

View bjoerge's full-sized avatar

Bjørge Næss bjoerge

View GitHub Profile
@bjoerge
bjoerge / SvgFileToStringInput.jsx
Created June 13, 2019 09:44
SvgFileToStringInput.jsx
import React from 'react'
import PropTypes from 'prop-types'
import {PatchEvent, set} from 'part:@sanity/form-builder/patch-event'
import FormField from 'part:@sanity/components/formfields/default'
export default class SvgFileToStringInput extends React.Component {
inputRef = React.createRef()
static propTypes = {
value: PropTypes.string,
type: PropTypes.object,
@bjoerge
bjoerge / recover-schema.md
Last active June 17, 2025 12:58
How to recover lost schema from *.sanity.studio.md

First, go to https://<yourname>.sanity.studio (or to the url of your studio if it's hosted elsewhere). Then open the developer console (usually by one of the keyboard shortcuts Command+Option+I, F12 or Control+Shift+I depending on what browser/platform you are using)

Steps

  1. Open the Sources tab
  2. Find the app.bundle.js file in the sidebar tree view.
  3. Hit the pretty print source button
  4. Locate your schema types by searching (e.g. try searching for one of your custom types) it in the source view.
@bjoerge
bjoerge / find-missing-assets.ts
Created March 27, 2020 09:44
Find missing assets in dataset
import got from "got"
import createClient from "@sanity/client"
import {asyncScheduler, concat, defer, EMPTY, from} from "rxjs"
import {
map,
mergeMap,
retry,
scan,
takeLast,
tap,