Skip to content

Instantly share code, notes, and snippets.

View bartlett705's full-sized avatar
:shipit:
Don't forget to commit

Ahmad K bartlett705

:shipit:
Don't forget to commit
  • Twitch
  • California (Southern)
View GitHub Profile
@bartlett705
bartlett705 / chompskify.html
Last active December 5, 2018 05:44
Chompskify - don't ask
<html>
<style>
body {
background-color: lightblue
}
li {
cursor: pointer;
display: flex;
flex-direction: row;
@bartlett705
bartlett705 / diffstrings.sh
Created September 29, 2018 09:10
diff 2 strings on the command line
#!/bin/bash
# shamelessley ripped from stack overflow
# compares two string args with 'success' message if they match exactly
string1=$1
string2=$2
[ "$string1" == "$string2" ] || { echo "⛔ dong due et ⛔" && false; } && echo "👍 good stuff 👍"
@bartlett705
bartlett705 / keybase.md
Last active May 6, 2018 07:07
attestation of identity

Keybase proof

I hereby claim:

  • I am bartlett705 on github.
  • I am bartlett705 (https://keybase.io/bartlett705) on keybase.
  • I have a public key whose fingerprint is 3B44 F098 6164 1C74 DC04 DC66 5382 C0A4 42FE 1C9D

To claim this, I am signing this object:

Pre-requisites:

  • Our jest unit and integration testing framework and helpers (link).
  • The enzyme package of React-specific testing utilities (link to enzyme 'getting started docs' or blog post)

I. Behavior-based Unit Tests - ShallowWrapper is your friend. A. Always use our helper setupShallowTest (or the underlying shallow method from enzyme directly) unless you have a really, really good reason not to. Currently accepted 'really good reasons' include: 1. A ComponentClass decorated with @withGraphQL, @withPubSub, or one of their variants. Since the HoC(s) abstract away the vast majority of the data-layer handling, this can still be considered a presentational component if it is essentially rendering data from the back-end(s) with no business logic other than a few notable exceptions. If your component requires more than two of the functionalities below, consider giving it a container to abstract away as much as possible but the actual markup template. a. Loading-state

There are plenty of use-cases for single-page apps sharing elements of state between different views. Sometimes (often?) you might want those views to be distinct routes. For a small project, pulling in redux or another flux-like can seem like a bit much. So how can we share a set of properties that lives in state between our various view routes using React and React Router?

Let's say we have a routing component structure somewhat like this:

<Router history={hashHistory}>
  <Route path="/" component={Home} >
    <IndexRoute component={Profile} />
    <Route path="profile" component={Profile}/>
    <Route path="host/:eventId" component={HostApp}/>