Skip to content

Instantly share code, notes, and snippets.

View dave-nicholas's full-sized avatar
💭
🚀

Dave Nicholas dave-nicholas

💭
🚀
View GitHub Profile
@dave-nicholas
dave-nicholas / apollo-schema.js
Last active January 4, 2018 12:57
apollo server typeDefs for blog article
const typeDefs = `
type River {
id: Int
name: String
streams: [Stream]
}
type Stream {
id: Int
name: String
river: River
@dave-nicholas
dave-nicholas / apollo-resolvers.js
Last active January 4, 2018 13:05
apollo server resolvers for blog article
const resolvers = {
River: {
async streams(river) {
return await Streams.find({ riverId: river.id }).toArray();
}
},
Stream: {
async river(stream) {
return await Streams.findOne({ riverId: stream.riverId });
},
@dave-nicholas
dave-nicholas / keybase.md
Created February 22, 2018 19:17
keybase.md

Keybase proof

I hereby claim:

  • I am dave-nicholas on github.
  • I am davenicholas (https://keybase.io/davenicholas) on keybase.
  • I have a public key ASBEuMp7BPSB0mp_yrYtbfRBlJKjecPXtunP8EHp16TeUwo

To claim this, I am signing this object:

@dave-nicholas
dave-nicholas / AsyncContainer.js
Last active March 11, 2018 13:40
A composed HOC for code splitting in react (requires recompose)
import React from 'react';
import { withState, compose, lifecycle } from 'recompose';
export default componentToImport => {
const state = withState('component', 'setComponent', null);
const hooks = lifecycle({
async componentDidMount() {
const { default: C } = await componentToImport();
this.props.setComponent(() => props => <C {...props} />);
@dave-nicholas
dave-nicholas / shaka-prft-changes.js
Created August 2, 2022 09:47
shaka prft mp4 box surfacing proposal
// file: streaming_engine.js
// The _append method will call this method
/**
* Parse PRFT box.
* @param {!shaka.media.SegmentReference} reference
* @param {!shaka.extern.ParsedBox} box
* @private
*/
parsePrft_(reference, box) {