Skip to content

Instantly share code, notes, and snippets.

View danmakenoise's full-sized avatar

Dan Phillips danmakenoise

View GitHub Profile
@danmakenoise
danmakenoise / test.js
Last active February 29, 2024 20:23
Unit Testing Children of React Context API Consumers with Enzyme
// Component.js
const Component = props => (
<MyContext.Consumer>
{(context) => (
<Foo
bar={props.bar}
baz={context.baz}
/>
)}
</MyContext.Consumer>
class Component extends React.Component {
constructor(props) {
super(props);
this.initialState = {
isBelowScrollLine: false
};
this.scrollListener = this.scrollListener.bind(this);
}
@danmakenoise
danmakenoise / jwplayer.js
Created September 22, 2016 18:22
Multiple Playlists
jwplayer("myelement").setup({
playlist: [{
playlist: 'https://foo.bar/breaking-news.json'
},
{
playlist: 'https://foo.bar/normal-playlist.json'
}]
})