Skip to content

Instantly share code, notes, and snippets.

devongovett /
Created May 1, 2021
Migration guide for React Spectrum Tabs

Tabs API Migration Guide

The API for the React Spectrum Tabs component changed significantly between Beta and RC. The documentation on the React Spectrum website has been updated to follow the new API. This guide aims to assist developers using the beta and wishing to upgrade to the new RC version.

In the previous API, the Tabs component accepted <Item> elements as children. Each item had a title prop representing the tab header, and children representing the tab contents.

<Tabs aria-label="History of Ancient Rome">
  <Item title="Founding of Rome" key="FoR">
    <Content marginTop="size-250" marginStart="size-125">
      <Text>Arma virumque cano, Troiae qui primus ab oris.</Text>
View App.js
const pageQuery = createQuery(); // create a top-level query
const App = () => (
// rendering MovieList automatically composes `MovieList.fragment` into the query.
children={({ loaded, data }) => {
let result = pageQuery(data);
return <MovieList data={result.movieList} />;
}} />
devongovett / index.js
Created Aug 13, 2016
requirebin sketch
View index.js
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
var AV = require('av');
player = AV.Player.fromURL('').play();
View gist:d7dc23df4afe8bbbf4e6
DBC = new r.Struct
# ...
stringBlockOffset: -> 4 * 5 + @recordCount * @recordSize
ptr: new r.Pointer(uint32le, new r.String(null), relativeTo: 'stringBlockOffset')
View jquery.transitionEnd.js
var $ = require('jquery');
var transitionEvents = 'transitionend msTransitionEnd webkitTransitionEnd';
var visibilityEvents = 'visibilitychange mozvisibilitychange msvisibilitychange webkitvisibilitychange';
* Runs the given callback when the next transition on the selected element finishes.
* Sometimes the transitionend event doesn't fire when the page is in a
* background tab, so we also handle the page visibility events here too.
devongovett /
Created Apr 10, 2014
Bash script to make a pull request from the current git repository. Tries the upstream remote if possible, otherwise uses origin.
# put this in your .bash_profile
pull_request() {
if [ -z $to_branch ]; then
# try the upstream branch if possible, otherwise origin will do
upstream=$(git config --get remote.upstream.url)
origin=$(git config --get remote.origin.url)
devongovett / height.js
Last active Aug 29, 2015
Set the height of a PDF page retroactively
View height.js
// add content
// this sets the height in the actual PDF output
// MediaBox[1] is really the Y, but PDFs use a flipped coordinate system
// where y=0 is at the bottom.
// make sure you do this before adding another page[1] = - doc.y;
devongovett / translate.js
Created Feb 2, 2014
Use PhantomJS to translate stdin to english using Google Translate. Useful as a textmate command or just a command line tool.
View translate.js
#!/usr/bin/env phantomjs
var system = require('system');
var text = encodeURIComponent(;
var url = "" + text;
var page = require('webpage').create();
page.settings.userAgent = 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:13.0) Gecko/20100101 Firefox/13.0';
page.onConsoleMessage = function (msg) {
devongovett / spinner.jade
Created Jul 15, 2013
Simple image-free loading spinner using Jade and Stylus
View spinner.jade
- for (var i = 1; i <= 12; i++)
View gist:4417385
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
char * number2filename(char *start, int digits, int num, char *end) {
int size = strlen(start) + strlen(end) + 1;
int formatSize = size + 3 + log10(digits) + 1;
char *format = (char *)malloc(formatSize);