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 { createStore } from 'redux'; | |
// reducer is the reducer we defined earlier | |
const store = createStore(reducer); |
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
store.dispatch( | |
{ | |
type: 'CHARACTER_TYPED', | |
char: 'x' | |
} | |
); |
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 state = store.getState(); | |
// Logs 'x' | |
console.log(state); |
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 unsubscribe = store.subscribe( () => console.log( store.getState() ) ); |
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
// Logs 'x' | |
store.dispatch(insertCharacter('x')); | |
// Logs 'xy' | |
store.dispatch(insertCharacter('y')); | |
// `removeCharacter` is an action creator wrapping the `BACKSPACE` action | |
// Logs 'x' | |
store.dispatch(removeCharacter()); | |
// Logs '' | |
store.dispatch(removeCharacter()); |
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
unsubscribe(); | |
// Nothing is logged | |
store.dispatch(insertCharacter('z')); |
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
sudo npm install -g sloc |
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
sloc src/ |
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
# This task will notify Sentry via their API[1] that you have deployed | |
# a new release. It uses the release timestamp as the `version` | |
# (like 20151113182847) and the git ref as the optional `ref` value. | |
# | |
# This task requires several environment variables be set (or just | |
# hardcode the values in here if you like living on the edge): | |
# | |
# ENV['SENTRY_API_ENDPOINT'] : API endpoint, https://app.getsentry.com | |
# ENV['SENTRY_ORG'] : the organization for this app | |
# ENV['SENTRY_PROJECT'] : the project for this app |
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
/* | |
* Step 1 | |
*/ | |
npm install --save-dev jsdom | |
/* | |
* Step 2 (http://airbnb.io/enzyme/docs/guides/jsdom.html) | |
* | |
* test-browser-env.js |