Skip to content

Instantly share code, notes, and snippets.

@daominhsangvn
daominhsangvn / gist:f2d369ab4aafe9783e96fbe05285cfbd
Last active September 16, 2022 19:12
Push Notifications in React-Native with FireBase
  1. Add new App in Firebase Console, select iOS and follow exactly instruction. 1a. In the GoogleService-Info.plist step, after download the file, open xCode, in Project Navigator right click Supporting folder and select Add files to ... then select the downloaded file.
  2. Following this to create App Id, APNs (.p8) and Provisioning Profile for iOS: https://firebase.google.com/docs/cloud-messaging/ios/certs 2a. Add APN file (.p8) to Firebase App
  3. Edit Podfile, add following below pod 'Firebase/Core': pod 'Firebase/Messaging' then $ pod install again
  4. Install react-native-fcm module then rnpm link react-native-fcm
  5. Following this https://github.com/evollu/react-native-fcm#shared-steps and this https://github.com/evollu/react-native-fcm#xcode-post-installation-steps
  6. Write Component to handle Push Notifications:
# main.js
@daominhsangvn
daominhsangvn / gist:454388252d541fbbc8b41c622c3c4e76
Created May 30, 2017 08:22 — forked from marty-wang/gist:5a71e9d0a6a2c6d6263c
Compile and deploy React Native Android app of Release version to device.
Disclaimer: The instructions are the collective efforts from a few places online.
Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did.
First off, bundle.
==================
1. cd to the project directory
2. Start the react-native packager if not started
3. Download the bundle to the asset folder:
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
@daominhsangvn
daominhsangvn / gist:9f2e4419d1f1d02b60c3ddf3febecfdb
Created July 14, 2017 03:09
FilesCollection Http method for React-Native
Install `$ meteor add meteorhacks:picker` first
```
import {Meteor} from 'meteor/meteor';
import {Accounts} from 'meteor/accounts-base';
import {FilesCollection} from 'meteor/ostrio:files';
export const MyFiles = new FilesCollection({
collectionName: 'MyFiles',
allowClientCode: true,
@daominhsangvn
daominhsangvn / react-native-style-guide.md
Last active March 3, 2022 19:26
React-Native Style Guide
@daominhsangvn
daominhsangvn / deploy-front-end-nodejs-to-aws-ec2-linux.md
Last active September 27, 2017 07:16 — forked from hpphat92/GUIDELINE_AWS.md
How to deploy front-end (AngularJS, Angular, ReactJS...) and nodejs to AWS EC2 Linux

How to deploy front-end (AngularJS, Angular, ReactJS...) and nodejs to AWS EC2 Linux

Preparation

  • PEM file containing private key from AWS server.
  • A domain to server
  • GIT Bash (In Window, can't use command line tool or powershell).

Steps:

Step 1: Connect to server:

@daominhsangvn
daominhsangvn / create-nois-react-native-project.md
Last active September 28, 2017 08:42
Create NOIS React-Native Project
  1. Init project:
$ react-native init <project_name>
  1. Add main dependencies:
$ yarn add moment lodash react-native-elements react-native-fetch-blob https://github.com/newoceaninfosys/react-native-gifted-form react-native-i18n react-native-image-crop-picker react-native-keyboard-aware-scroll-view react-native-loading-spinner-overlay react-native-navbar react-native-splash-screen react-native-vector-icons react-navigation realm
@daominhsangvn
daominhsangvn / redux-react-nagivation-integration.md
Last active October 31, 2017 08:43 — forked from hle50/rm.md
Integrate React into React with React-Navigation
  1. Install redux $ yarn add react-redux
  2. At project root folder, create folder store then create file configureStore.js in store folder:
import { createStore } from 'redux';
 
import reducers from '../reducers'
 
export default function configureStore(initialState) {
  const store = createStore(
    reducers,
@daominhsangvn
daominhsangvn / npm-publish.md
Last active December 13, 2017 05:03
How to publish package to npmjs
  1. $ npm login or $ npm adduser from your Terminal to login to NpmJS
  2. Add file .npmignore then ignore files that will not neccessary for the publish version
  3. $ npm pack to test the output
  4. $ npm init --scope=nois config org for the package
  5. $ npm publish --access public
@daominhsangvn
daominhsangvn / interview-questions-and-awnsers.md
Created January 12, 2018 08:05
Interview questions and awnsers

Javascript

  1. How to create a copy of an array such that changes to the old array will not be reflected in the new array?
// affected by using splice, pop, unshift, push...
var newArray = oldArray.splice(0);
  1. Function prototype?