Skip to content

Instantly share code, notes, and snippets.

View storybynumbers's full-sized avatar

Jason Yergeau storybynumbers

View GitHub Profile
@storybynumbers
storybynumbers / RichText.jsx
Last active December 14, 2018 10:56
render contentful rich text as react components
import {
BLOCKS,
MARKS,
INLINES,
helpers
} from '@contentful/rich-text-types';
const defaultInline = (type, node, key) => {
return <span key={key} style={{
margin: '0px 5px',
@storybynumbers
storybynumbers / withTheme.jsx
Last active November 16, 2018 14:55
Wrapping styled components themeprovider without breaking next.js SSR
import React from 'react';
import { ThemeProvider } from 'styled-components';
import { loadGetInitialProps } from 'next/dist/lib/utils';
const MyTheme = {
fontSizes: [
12, 14, 16, 20, 24, 32, 48, 64
]
};

Keybase proof

I hereby claim:

  • I am storybynumbers on github.
  • I am storybynumbers (https://keybase.io/storybynumbers) on keybase.
  • I have a public key ASBo34pHXAjUnBKRw9j_rGdsuKuy_GZYHAiHGJytAc28ogo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am aquariumtap on github.
  • I am storybynumbers (https://keybase.io/storybynumbers) on keybase.
  • I have a public key ASB9hQ2WfwjHfgUEugORga3fAI6aRZPJ7FNg5CrVNid19Qo

To claim this, I am signing this object:

@storybynumbers
storybynumbers / gist:cd08617e6777e6162dee
Created January 20, 2015 16:20
Filtering out pubsub events from my console.log()

I broadcast all of my pubsub events to console.log() in this format:

["Event: SOME_EVENT"]

The regex is tested against the message, but also the filename, so that must be held into account. To filter them out using regex in Chrome.

^(?!\["Event:*.)(?!.*\.js)
@storybynumbers
storybynumbers / gist:953ce9fb3a89c0b5d962
Created January 20, 2015 15:56
A promise-returning function called with parameters using Q.then(), chained sequentially
var ani = function(d) {
var deferred = Q.defer();
setTimeout(function() {
console.log('this delayed by ' + d);
deferred.resolve();
}, d);
return deferred.promise;
}
ani(1000).then(
@storybynumbers
storybynumbers / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console