Skip to content

Instantly share code, notes, and snippets.

View tylercollier's full-sized avatar

Tyler Collier tylercollier

  • Email: github2 at my first and last name dot com
  • Phoenix, AZ, USA
View GitHub Profile
// Callbacks!
// Reminder: Run this with quokka if you want to see results instantly in your editor.
// https://quokkajs.com/
// Part 1
// If I gave you an array of numbers, and told you to list just the odds, you might do this:
var numbers = [1, 2, 3, 4, 5, 6];
var odds = [];
@tylercollier
tylercollier / setTimeout.js
Last active May 14, 2019 21:52
medium-article-closures
const message = 'hello from a closure'
setTimeout(() => {
console.log(message)
}, 1000)
// or, same thing on one line
setTimeout(() => console.log(message), 1000)
@tylercollier
tylercollier / renderprops.js
Last active November 29, 2016 04:15
RenderProps challenges
// Using RenderProps (https://github.com/ReactTraining/react-subjects/blob/master/subjects/RenderProps/exercise.js),
// how can I:
//
// 1) compose multiple fetches to be run simultaneously? In the example below, fetching credits would be blocked until
// debits have been fetched.
//
// 2) test the component without the fetches happening? Normally I'll have a component that takes props, and connect it
// to redux, and export both the connected component (as default) and the so-called presentational component as a named
// const. This allows me to preview the render using e.g. React Storybook.