Name of thing | Sorta like... | Mounted? | Can you even setState? | What would you say... ya do here? |
---|---|---|---|---|
constructor | initialize() | nope | nope | init stuff NO side effects |
componentWillMount | beforeDomReady() | nope | yeah but don't | Only needed in createClass now use constructor for most things |
render | render | nope | please no | render stuff and don't set any state please |
componentDidMount | domReady() | yup | yup | DOM is a go init jQuery plugins dispatch stuff |
componentWillReceiveProps | onChange() | yup | yup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import formatPrice from "../utils/formatPrice"; | |
export interface IPriceProps { | |
num: number; | |
symbol: "$" | "€" | "£"; | |
} | |
const Price: React.SFC<IPriceProps> = ({ | |
num, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @ts-check | |
/** | |
* Format a price | |
* @param num {number} The price | |
* @param symbol {string} The currency symbol | |
*/ | |
const formatPrice = (num, symbol = "$") => | |
`${symbol}${num.toFixed(2)}`; | |
formatPrice("1234"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const formatPrice = (num: number, symbol = "$": string) => | |
`${symbol}${num.toFixed(2)}`; formatPrice("1234"); | |
// num.toFixed is not a function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const formatPrice = (num, symbol = "$") => | |
`${symbol}${num.toFixed(2)}`; formatPrice("1234"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Run tests", | |
"program": "${workspaceRoot}/node_modules/.bin/jest" | |
}, | |
{ |
Install each of the following tools to help along the way.
Pick a terminal wrapper, either is fine...
Install XCode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const toggleAssigned = (function () { | |
let showing = false; | |
return function (username) { | |
const $cards = $$(".issue-card"); | |
Array.from($cards).forEach((el) => { | |
if (!showing) { | |
if (!el.querySelectorAll("img[alt='@" + username + "']").length) { | |
el.style = "display:none"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
input=$1 | |
query=${input// /%20} | |
url=http://api.giphy.com/v1/gifs/search\?q=$query\&api_key\=dc6zaTOxFJmzC | |
image=$(curl -s $url | jq '.data[0] | { url: .images.fixed_height.url } | .url') | |
echo "Added $image to the clipbboard." | |
echo ${image//\"/ } | pbcopy |