This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Platform info: | |
Darwin 15.6.0 x64 | |
Node.JS 6.6.0 | |
V8 5.1.281.83 | |
Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz × 8 | |
var vs let | |
922,009,444 op/s » with var | |
19,823,034 op/s » with let |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NativeModules, DeviceEventEmitter, Platform } from 'react-native'; | |
import { Base } from './../base'; | |
const FirebaseMessaging = NativeModules.RNFirebaseMessaging; | |
export const EVENT_TYPE = { | |
RefreshToken: 'FCMTokenRefreshed', | |
Notification: 'FCMNotificationReceived', | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sampleData = { | |
somePostId1: { | |
title: 'today now', | |
timestamp: Date.now(), | |
startOfDay: 1502838000, | |
}, | |
somePostId3: { | |
title: 'today but older', | |
timestamp: Date.now() - 10000000, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.invertase.firebase; | |
import android.app.Activity; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.content.IntentFilter; | |
import android.content.BroadcastReceiver; | |
import com.facebook.react.bridge.Arguments; | |
import com.facebook.react.bridge.LifecycleEventListener; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Modify sails blueprint parse result | |
* @param req | |
* @return {*} | |
*/ | |
function parseBlueprintOptions(req) { | |
const queryOptions = sails.hooks.blueprints.parseBlueprintOptions(req); | |
// do blueprint overrides if needed... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import firebase from 'react-native-firebase'; | |
// disable default behaviour so we can control the flow ourselves | |
// this mus be called module scope (outside any classes etc) | |
// preferably before any other usages of RNFirebase so that | |
// it's disabled before internal RNFirebase logic takes over | |
firebase.utils().errorOnMissingPlayServices = false; | |
firebase.utils().promptOnMissingPlayServices = false; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { version } = require('./package.json'); | |
// ... inside your app startup logic | |
try { | |
const storedVersion = await AsyncStorage.getItem('@MyStore:appVersion'); | |
if (storedVersion !== version){ | |
// do logout logic here | |
// then update the stored version to be the newest version so next | |
// restart of app won't trigget this again |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const should = require('should'); | |
describe('bridge', () => { | |
beforeEach(async function beforeEach() { | |
await device.reloadReactNative(); | |
bridge.root.setState({ message: this.currentTest.title }); | |
}); | |
it('should provide -> global.bridge', () => { | |
should(bridge).not.be.undefined(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ipc = require('node-ipc'); | |
ipc.config.id = 'a-unique-process-name1'; | |
ipc.config.retry = 1500; | |
ipc.config.silent = true; | |
ipc.serve(() => ipc.server.on('a-unique-message-name', message => { | |
console.log(message); | |
})); | |
ipc.server.start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.testing; | |
import android.app.Application; | |
import com.facebook.react.ReactApplication; | |
import com.facebook.react.ReactNativeHost; | |
import com.facebook.react.ReactPackage; | |
import com.facebook.react.shell.MainReactPackage; | |
import com.facebook.soloader.SoLoader; |
OlderNewer