Skip to content

Instantly share code, notes, and snippets.

View andrerfneves's full-sized avatar
🖖

André Neves andrerfneves

🖖
View GitHub Profile
@andrerfneves
andrerfneves / ClickOutside React Component
Created September 17, 2018 19:25
ClickOutside React Component
// @flow
import React, { PureComponent } from 'react';
type Props = {
onClickOutside: Function,
children: any,
};
export default class ClickOutside extends PureComponent<Props> {
@andrerfneves
andrerfneves / main-container.js
Last active August 31, 2017 19:33
MainTileContainer: Container in a React Native application that handles business logic and mapping of application state to props. This leverages HOC components (redux's `connect`) for abstracting common logic between components.
// @flow
import { connect } from 'react-redux';
import MainTileScreen from '../../screens/main-tile/main-tile';
import { fetchPageData } from '../../actions/api/page/fetch-page-data';
import { navigateToRoute } from '../../actions/navigation/navigate-to-route';
import { showModal } from '../../actions/navigation/show-modal';
import { toggleDrawer } from '../../actions/navigation/toggle-drawer';
const mapStateToProps = (state: Object) => ({
@andrerfneves
andrerfneves / fetch-page-data.js
Last active August 31, 2017 19:31
Typical API request for a React application using `redux-thunk` to handle asynchronous calls and trigger request, success, and error action creators.
// @flow
import { getPageData } from '../../../services/api';
import { toggleAppStateLoading } from '../loading/toggle-app-state-loading';
import {
FETCH_PAGE_DATA_ERROR,
FETCH_PAGE_DATA_REQUEST,
FETCH_PAGE_DATA_SUCCESS,
} from '../../../constants/action-names';
@andrerfneves
andrerfneves / main-tile.js
Last active August 31, 2017 19:38
MainTileView: Component responsible for loading top level pages of a React Native application. It deals with loading dynamic JSON data from an API and follows an internal parsing algorithm to decide which components are rendered to the View. Some complex animation is also handled on the `onScroll` prop of the main ScrollView.
// @flow
import React, { Component } from 'react';
import { View, FlatList, RefreshControl, Animated } from 'react-native';
import LinearGradient from 'react-native-linear-gradient';
import Loader from '../../components/loader/loader';
import Navbar from '../../components/navbar/navbar';
import { parseMetadataIntoComponents } from '../../services/parse-metadata';
import { findPageDataByPath, findNavDataByPath, findNavIndexByPath } from '../../utils/array';
import { uuid } from '../../utils/uuid';
# Trip Notes
- [ ] Amazon Lex
- [ ] Natural Language Processing (NLP) service
- [ ] Same as Amazon Alexa.
- [ ] Amazon Alexa passes 10M devices sold in May 2017
- [ ] http://files.constantcontact.com/150f9af2201/ac5db202-a413-42da-ab8b-fee61f1acc6e.pdf
- [ ] No more language barrier issues, if Alexa can understand your phrases, then your product (using Lex) can also understand you
- [ ] Product has access to the `voice`, `string`, and any other data format generated from any input from user
- [ ] Chat Interfaces
- [ ] Facebook Messenger
@andrerfneves
andrerfneves / gist:bf3174c0d7adf35e0a77eff0b97e71c9
Last active January 2, 2018 18:44
Useful React Native NPM Scripts
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"rc-start": "npm start -- --reset-cache",
"clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean",
"clean-start": "npm run clean && npm run rc-start",
"fresh-install": "rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build/ModuleCache/* && rm -rf node_modules/ && npm cache clean && npm install",
"fresh-start" : "npm run fresh-install && npm run rc-start",
"tron": "node_modules/.bin/reactotron"
}
-- MySQL dump 10.13 Distrib 5.6.22, for osx10.8 (x86_64)
--
-- Host: localhost Database: bhportfolio
-- ------------------------------------------------------
-- Server version 5.5.46-0ubuntu0.14.04.2
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
Template.showSubmit.events({
'submit form': function(e) {
e.preventDefault();
var show = {
url: $(e.target).find('[name=url]').val(),
title: $(e.target).find('[name=title]').val()
};
show._id = Shows.insert(show);
Meteor.startup(function() {
ServiceConfiguration.configurations.remove({service: 'meteor-developer'});
ServiceConfiguration.configurations.insert({
service: 'meteor-developer',
clientId: Meteor.settings.meteorDeveloper.clientId,
secret: Meteor.settings.meteorDeveloper.secret
});
});
Accounts.onCreateUser(function(options, user) {
@andrerfneves
andrerfneves / gist:da4ed5acc8f139fdfd80
Created February 23, 2015 20:25
Error in 'meteor' on telescopedemo
andreneves @ ~/Code/crewcont/telescopedemo
[188] meteor
[[[[[ ~/Code/crewcont/telescopedemo ]]]]]
=> Started proxy.
=> Started MongoDB.
telescope-email: updating npm dependencies -- html-to-text...
telescope-post-by-feed: updating npm dependencies -- htmlparser2, to-markdown, he...
npm WARN package.json packages-for-meteor-smartpackage-ds9snv@0.0.0 No description
npm WARN package.json packages-for-meteor-smartpackage-ds9snv@0.0.0 No repository field.