Skip to content

Instantly share code, notes, and snippets.

View ernestofreyreg's full-sized avatar
🚢
Just ship it

Ernesto Freyre ernestofreyreg

🚢
Just ship it
View GitHub Profile
import React from 'react'
import { storiesOf } from '@storybook/react'
import { action } from '@storybook/addon-actions'
import { linkTo } from '@storybook/addon-links'
import {Button} from '../src/index'
storiesOf('Button', module)
.add('simple text', () => <Button title='Hello Button' onClick={action('clicked Hello Button')} />)
const RTM = require('satori-rtm-sdk')
// create an RTM client instance
const rtm = new RTM('YOUR_ENDPOINT', 'YOUR_APPKEY')
// create a new subscription with 'your-channel'
const channel = rtm.subscribe('YOUR_CHANNEL', RTM.SubscriptionMode.SIMPLE)
// add channel data handlers
import React from 'react'
import RTM from 'satori-rtm-sdk'
class Index extends React.Component {
state = {}
componentDidMount () {
const rtm = new RTM('YOU_ENDPOINT', 'YOUR_APPKEY')
const channel = rtm.subscribe('YOUR_CHANNEL', RTM.SubscriptionMode.SIMPLE)
function SomeService () {
this.name = 'some';
}
SomeService.prototype.method = function(params) {
// Do some shit like...
console.log(this.name);
}
module.exports = new SomeService();
function someService () {
const name = 'some';
function method() {
// Do some shit like...
console.log(name);
}
return { method };
}
const name = 'some';
function method() {
// Do some shit like...
console.log(name);
}
module.exports = { method }
function extractResponse (response) {
if (response.status === 200) {
return response.data
}
return []
}
function processError (err) {
logger.error(err)
class Connected extends React.PureComponent {
constructor (props, context) {
super(props, context)
this.blah = createNewBlah()
}
componentWillWhatever() {
// Do anything here
}
import express from 'express'
import { status } from './middlewares/status'
const app = express()
app.get('/api/status', status)
export const handler = app
import axios from 'axios'
const createUrlLoader = url => {
const initialState = {
loading: false,
data: null,
error: null
}
const STARTED_LOADING = 'STARTED_LOADING'