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
// Runs resetError() AFTER storeToken(token) | |
export function renewToken({ clientId, redirectUri }) { | |
return (dispatch, getState) => { | |
getOAuthToken({ clientId, redirectUri }) | |
.then(token => | |
dispatch(storeToken(token)) | |
) | |
.then(() => { | |
dispatch(resetError()); | |
}); |
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 React, { PropTypes } from 'react'; | |
import { connect } from 'react-redux'; | |
import flow from 'lodash/flow'; | |
import { FormattedMessage } from 'react-intl'; | |
import { storeToken } from '../actions/securityActions'; | |
import { resetError } from '../actions/errorsActions'; | |
import { setCampaign } from '../actions/campaignActions'; |
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
// Must be defined before thunk | |
const promiseCatcher = store => next => action => { | |
if (typeof action !== 'function') { | |
return next(action); | |
} | |
const decoratedAction = (dispatch, getState) => { | |
const p = action(dispatch, getState); | |
return Promise.resolve(p).then(err => console.log(action)); | |
}; | |
return next(decoratedAction); |
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
function Foo() { | |
const onSearch = () => { console.log('search woo') }; | |
const onResponse = () => { console.log('response woo')}; | |
return ( | |
<div className="field"> | |
<View | |
className="auto-complete" | |
onSearch={onSearch} | |
onResponse={onResponse} | |
/> |
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
.catch(getErrorFromResponse(formatMessage({ id: 'messages.actions.folder.create.failure.message' }))) | |
.catch(errorMsg => | |
showErrorMessage({ | |
title: formatMessage({ id: 'messages.actions.folder.create.failure.title' }), | |
content: errorMsg, | |
}) && Promise.reject(errorMsg) | |
); |
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
export const getErrorFromResponse = defaultMessage => error => | |
error.response.json().then(error => { | |
try { | |
return Promise.reject(error.error.exception[0].message) | |
} catch (e) { | |
return Promise.reject(defaultMessage) | |
} | |
}); |
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
'body': | |
'ctrl-tab ^ctrl': 'unset!' | |
'ctrl-tab': 'pane:show-next-item' | |
'ctrl-shift-tab ^ctrl': 'unset!' | |
'ctrl-shift-tab': 'pane:show-previous-item' | |
set tabstop=2 " tab width is 4 spaces | |
set shiftwidth=2 " indent also with 4 spaces | |
set expandtab | |
syntax on " syntax highlighting |
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
overviewAction(self.parameters) | |
.then(function (response) { | |
console.log('overview: ', response) | |
self.overviewData = response.value[0]; | |
return topMentionsHashtagsAction(self.parameters) | |
}) | |
.then(function (response) { | |
console.log('top: ', response.value) | |
self.topHashtags = response.value.hashtags.slice(1, 3) | |
self.topMentions = response.value.mentions.slice(1, 3) |
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
// github-cycle.js | |
function main (sources) { | |
let request$ = sources.props$ | |
.map((prop) => { | |
url: 'http://github.com/api/' + prop, | |
}) | |
let response$ = sources.HTTP | |
.flatten(); |
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
{ | |
id: message.r.id, | |
host: node.host || node.address, | |
port: node.port, | |
token: message.r.token | |
} |