Skip to content

Instantly share code, notes, and snippets.

View viniciusdacal's full-sized avatar

Vinicius Dacal viniciusdacal

View GitHub Profile
// By Jamie Chapman, @chappers57
// License: open, do as you wish, just don't blame me if stuff breaks ;-)
public class ParseProxyObject implements Serializable {
private static final long serialVersionUID = 1L;
private HashMap<String, Object> values = new HashMap<String, Object>();
private String ObjectId;
private Date CreatedAt;
private Date UpdatedAt;
<!--INSERT THIS TAG WHERE YOU WANT TO PLACE THE WIDGET-->
<!--you can set the width and height using css rules-->
<div id="ot__ondetem" style="width:800px; height: 400px"></div>
<!--INSERT THIS JUST BEFORE THE BODY END-->
<script>
(function(d, s, id) {
var gtin = 10527;
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
dispatch({type: CALL_API_REQUEST});
http.get('http://api.myapp.com/service')
.then(
(result) => dispatch({type: CALL_API_SUCCESS, body: result}),
(error) => dispatch({type: CALL_API_FAILURE, error: error}),
);
import http from './HttpClient'; //simple http request manager
export function getContacts({ userId }) {
const payload = { userId };
return {
types: [
GET_CONTACTS_REQUEST,
GET_CONTACTS_SUCCESS,
GET_CONTACTS_FAILURE,
],
export function callAPIMiddleware(store) {
const { dispatch, getState } = store;
return next => action => {
const {
types,
callAPI,
payload = {},
} = action;
function logger(store) {
const { dispatch, getState } = store;
return next => action => {
console.group(action.type);
console.info('dispatching', action);
let result = next(action);
console.log('next state', getState());
console.groupEnd(action.type);
return result;
};
import { applyMiddleware, createStore } from 'redux';
import callAPIMiddleware from './callAPIMiddleware';
let store = createStore(
rootReducer,
initialState,
applyMiddleware(callAPIMiddleware)
);
const asyncAction = {
types: [
CALL_API_REQUEST,
CALL_API_SUCCESS,
CALL_API_FAILURE,
],
callAPI: () => http.get('http://api.myapp.com/service', {id: 1}),
payload: {id: 1},
}
import React, {Component} from 'react';
const {
LineChart,
Line,
XAxis,
YAxis,
CartesianGrid,
Tooltip,
Legend
} from 'recharts';
import React from 'react';
import { render } from 'react-dom';
import { Router, Route, Link, browserHistory } from 'react-router';
const App = React.createClass({
render() {
const { children } = this.props;
return (
<div>
{/* you can insert the menu here */}