Skip to content

Instantly share code, notes, and snippets.

View horacioh's full-sized avatar
💪
hustling

Horacio Herrera horacioh

💪
hustling
View GitHub Profile
@horacioh
horacioh / .env
Created January 17, 2019 09:39
Alias the `src` directory on create-react-app
NODE_PATH=.
@horacioh
horacioh / index.js
Created August 28, 2018 13:38
open mdx presentation from list
// by default it will look for `.mdx` files into the `./presentations` folder
const testFolder = './presentations';
const fs = require('fs');
const path = require('path');
const prompts = require('prompts');
const cmd = require('node-cmd');
if (!fs.existsSync(testFolder)) {
// testFolder does not exist
@horacioh
horacioh / README.txt
Created April 1, 2018 22:40
RN Scaffold - File tree
── MyApp
└── src
├── app
│ ├── index.js
│ ├── Root.js
│ ├── App.js
│ ├── config
│ │ └── index.js
│ ├── components
│ │ ├── index.js
@horacioh
horacioh / routes.js
Created April 1, 2018 22:39
RN Scaffold - routes.js
// MyApp/src/app/navigators/routes.js
// @flow
export const PRIVATE_ROUTE: string = 'PRIVATE_ROUTE'
export const PUBLIC_ROUTE: string = 'PUBLIC_ROUTE'
export const SIGNIN_ROUTE: string = "SIGNIN_ROUTE"
export const HOME_ROUTE: string = "HOME_ROUTE"
export const HOME_SCREEN_ROUTE: string = "HOME_SCREEN_ROUTE"
@horacioh
horacioh / index.js
Created April 1, 2018 22:39
RN Scaffold - Navigators Index.js
// MyApp/src/app/navigators/index.js
// @flow
import * as React from 'react'
import { SwitchNavigator } from 'react-navigation'
import PrivateRoot from './PrivateRootNavigator'
import PublicRoot from './PublicRootNavigator'
import { PRIVATE_ROUTE, PUBLIC_ROUTE } from './routes'
@horacioh
horacioh / index.js
Created April 1, 2018 22:38
RN Scaffold - index.js
// MyApp/src/app/index.js
import React, { Component } from 'react';
import { API_URL } from './config';
import ApolloClient from 'apollo-client';
import { HttpLink } from 'apollo-link-http';
import { InMemoryCache } from 'apollo-cache-inmemory';
import Root from './Root';
@horacioh
horacioh / Root.js
Created April 1, 2018 22:38
RN Scaffold - Root.js
// MyApp/src/app/Root.js
// @flow
import * as React from 'react'
import { ApolloProvider } from 'react-apollo'
import App from './App';
type Props = {
graphqlClient: any
@horacioh
horacioh / PublicNavigator.js
Created April 1, 2018 22:37
RN Scaffold - PublicNavigator.js
// MyApp/src/app/navigators/PublicNavigator.js
// @flow
import * as React from 'react'
import { SwitchNavigator } from 'react-navigation'
import SignIn from '../../auth/SignInScreen'
import { SIGNIN_ROUTE } from './routes'
@horacioh
horacioh / PrivateNavigator.js
Last active April 1, 2018 22:36
RN Scaffold - PrivateNavigator.js
// MyApp/src/app/navigators/PrivateNavigator.js
// @flow
import * as React from 'react'
import { TabNavigator } from 'react-navigation'
import { Icon } from 'react-native-elements'
import HomeNavigator from '../../home/HomeNavigator'
import { HOME_ROUTE } from './routes'
@horacioh
horacioh / App.js
Last active April 1, 2018 22:44
RN Scaffold : MyApp/src/app/App.js
// MyApp/src/app/App.js
// @flow
import * as React from 'react'
import { Font } from 'expo'
import { isSignedIn } from '../auth/utils/auth'
import { createPrivateRootNavigator, createPublicRootNavigator } from './navigators'
type State = {
fontLoaded: boolean,