Skip to content

Instantly share code, notes, and snippets.

Avatar

Spencer Carli spencercarli

View GitHub Profile
View AndroidFontFix.js
// App/utilities/AndroidFontFix.js
import React from 'react';
import { Platform, StyleSheet, Text } from 'react-native';
import { getManufacturerSync } from 'react-native-device-info';
// https://github.com/castle-xyz/castle-client/pull/11/files
// This fixes this bug: https://github.com/facebook/react-native/issues/15114
// As of 6/2/2020, this bug is marked as closed and Facebook has signalled that
View MediumScaper.js
const fs = require('fs');
const fetch = require('node-fetch');
const data = require('./data');
const target = 'name="description" content="';
const target2 = 'rel="canonical" href="';
const fetchData = (post) => {
return fetch(post.url)
.then(res => res.text())
@spencercarli
spencercarli / customAnimatedSequence.js
Created Dec 21, 2017
React Native Animated.Sequence that calls a function each time a step in the sequence starts
View customAnimatedSequence.js
const customAnimatedSequence = (animations, onStepStart) => {
let current = 0;
return {
start: (callback) => {
const onComplete = (result) => {
if (!result.finished) {
callback && callback(result);
return;
}
View manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bamms"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-sdk
android:minSdkVersion="16"
View bd3d4befe38185704bf0fc875e9deed6|configuration.json
{"contents":{"editor":{"formatOnSave":true}},"overrides":[],"keys":["editor.formatOnSave"]}
@spencercarli
spencercarli / index.js
Created Feb 3, 2017
react-native-meteor-offline
View index.js
import Meteor from 'react-native-meteor';
import { AsyncStorage } from 'react-native';
import { createStore, applyMiddleware } from 'redux';
import createLogger from 'redux-logger';
import { persistStore, autoRehydrate } from 'redux-persist';
import _ from 'lodash';
import reducer from './reducer';
// Actions
@spencercarli
spencercarli / signOut.js
Created Mar 9, 2016
Connecting the Meteor and React Native Apps - signOut.js
View signOut.js
// RNApp/app/containers/signOut.js
handleSignOut() {
GoogleSignin.signOut()
.then(() => {
ddpClient.logout(() => {
this.props.changedSignedIn(false);
});
})
.catch((err) => {
@spencercarli
spencercarli / signIn.js
Created Mar 9, 2016
Connecting the Meteor and React Native Apps - signIn.js
View signIn.js
// RNApp/app/containers/signIn.js
handleDDPSignIn(googleUser) {
if (googleUser) {
ddpClient.loginWithGoogle(googleUser, (err, res) => {
if (err) {
this.setState({error: err.reason});
} else {
this.props.changedSignedIn(true);
}
@spencercarli
spencercarli / ddp.js
Created Mar 9, 2016
Connecting the Meteor and React Native Apps - ddp.js
View ddp.js
// RNApp/app/ddp.js
ddpClient.loginWithGoogle = (user, cb) => {
let params = { google: user };
return ddpClient.call("login", [params], (err, res) => {
ddpClient.onAuthResponse(err, res);
cb && cb(err, res)
})
}