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
# xcode-build-bump.sh | |
# @desc Auto-increment the build number every time the project is run. | |
# @usage | |
# 1. Select: your Target in Xcode | |
# 2. Select: Build Phases Tab | |
# 3. Select: Add Build Phase -> Add Run Script | |
# 4. Paste code below in to new "Run Script" section | |
# 5. Drag the "Run Script" below "Link Binaries With Libraries" | |
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0) |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
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 {action1, action2} from "myActions"; | |
import {bindActionCreators} from "redux"; | |
const mapDispatchToProps(dispatch) => { | |
return { | |
manuallyBoundAction : (...args) => dispatch(action1(...args)), | |
autoBoundAction : bindActionCreators(action2, dispatch), | |
multipleActionsTogether : bindActionCreators({action1, action2}, dispatch) | |
} | |
}; |
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
// connect() is a function that injects Redux-related props into your component. | |
// You can inject data and callbacks that change that data by dispatching actions. | |
function connect(mapStateToProps, mapDispatchToProps) { | |
// It lets us inject component as the last step so people can use it as a decorator. | |
// Generally you don't need to worry about it. | |
return function (WrappedComponent) { | |
// It returns a component | |
return class extends React.Component { | |
render() { | |
return ( |
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
// approach 1: define action object in the component | |
this.props.dispatch({ | |
type : "EDIT_ITEM_ATTRIBUTES", | |
payload : { | |
item : {itemID, itemType}, | |
newAttributes : newValue, | |
} | |
}); | |
// approach 2: use an action creator 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
#!/bin/bash | |
files=$(git diff --cached --name-only | grep '\.jsx\?$') | |
# Prevent ESLint help message if no files matched | |
if [[ $files = "" ]] ; then | |
exit 0 | |
fi | |
failed=0 | |
for file in ${files}; do |
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
int doubler(int x) { | |
return 2 * x; | |
} |
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 { createAction } from 'redux-actions'; | |
import { | |
NAVIGATION_PUSH, | |
NAVIGATION_POP, | |
NAVIGATION_RESET_TO, | |
NAVIGATION_POP_TO_ROOT | |
} from './actions'; | |
export const push = createAction(NAVIGATION_PUSH); | |
export const pop = createAction(NAVIGATION_POP); |
OlderNewer