Skip to content

Instantly share code, notes, and snippets.

View stipsan's full-sized avatar

Cody Olsen stipsan

View GitHub Profile
@stipsan
stipsan / README.md
Created July 10, 2024 17:48
How to implement the `Sec-CH-Prefers-Color-Scheme` header with `@sanity/ui`'s `usePrefersDark` hook
@stipsan
stipsan / README.md
Created July 10, 2024 16:50
How to implement the `Sec-CH-Prefers-Reduced-Motion` header with `@sanity/ui`'s `usePrefersReducedMotion` hook
@stipsan
stipsan / create_release_branch.yml
Created August 22, 2022 17:42 — forked from riggaroo/create_release_branch.yml
Github Action workflow for creating release branch, updating versionName and versionCode, copying strings.xml to another repo, submitting PRs as per GitFlow.
name: Create Release Branch
on:
workflow_dispatch:
inputs:
versionName:
description: 'Name of version (ie 5.5.0)'
required: true
versionCode:
description: 'Version number (50500)'
required: true
@stipsan
stipsan / github-actions-notes.md
Created August 22, 2022 17:41 — forked from br3ndonland/github-actions-notes.md
Getting the Gist of GitHub Actions
@stipsan
stipsan / README.md
Created August 3, 2022 08:56
Readme test

sanity-plugin-internationalized-array

NOTE This is for the Studio v2 version of the plugin

There is a Studio v3 specific version in the studio-v3 branch

A helper function that renders a custom input component for writing localised fields of content into an array.

2022-07-13 12 53 29

@stipsan
stipsan / console.js
Created August 2, 2022 09:01
Query Sanity Studio version status from the Exchange
// Run these snippets from your DevTools console
const {default: createClient} = await import('https://unpkg.com/@sanity/client@esm/dist/sanityClient.browser.mjs')
const client = createClient({projectId: '81pocpw8', dataset: 'production'})
// Get all v3 ready plugins
await client.fetch(`*[studioVersion == 3 || defined(v3DistTag)].packageName`)
// Get v3 only, the listing never had a v2 version
await client.fetch(`*[studioVersion == 3 && studioV2Support == ""]`)
@stipsan
stipsan / index.js
Created April 23, 2022 20:11
Workaround is-hotkey + skypack issue
/**
* Constants.
*/
const IS_MAC = (
typeof window != 'undefined' &&
/Mac|iPod|iPhone|iPad/.test(window.navigator.platform)
)
@stipsan
stipsan / test.js
Created February 3, 2022 22:36
What error is thrown when a fetch is aborted?
// Paste in your DevTools console to inspect the error object thrown by fetch
const controller = new AbortController()
fetch(window.location.href, {signal: controller.signal}).catch((err) => {
console.dir(err)
console.assert(err.name === 'AbortError', `${err.name} === 'AbortError'`)
console.assert(err.code === 20, `${err.code} === 20`)
console.assert(
err.message === 'The user aborted a request.',
`${err.message} === 'The user aborted a request.'`
)
@stipsan
stipsan / import-map.json
Created November 17, 2020 07:50
Minimap
{"imports":{"@podium/browser":"https://unpkg.com/browse/@podium/browser@1.0.0/src/index.js"}}
@stipsan
stipsan / masonryWorklet.ts
Created November 22, 2019 12:32
Masonry worklet example
// Plan on making a react/web component that reuses the layout logic from the worklet to lay out and
// reoder a css columns top down layout to a ltr flow
// From https://github.com/GoogleChromeLabs/houdini-samples
registerLayout(
'masonry',
class {
static get inputProperties() {
return ['--padding', '--columns'];