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 / 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 / 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 / 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 / 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 / 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 / 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 / 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 / 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 / .env
Created January 17, 2019 09:39
Alias the `src` directory on create-react-app
NODE_PATH=.

I had pushed this schema.graphql:

type Post @model {
  id: ID!
  title: String!
  slug: String!
  content: String!
 createdAt: String!