Skip to content

Instantly share code, notes, and snippets.

View spencercarli's full-sized avatar

Spencer Carli spencercarli

View GitHub Profile
@spencercarli
spencercarli / AndroidFontFix.js
Created February 1, 2021 15:46
OnePlus Font Fix
// 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
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 December 21, 2017 16:32
React Native Animated.Sequence that calls a function each time a step in the sequence starts
const customAnimatedSequence = (animations, onStepStart) => {
let current = 0;
return {
start: (callback) => {
const onComplete = (result) => {
if (!result.finished) {
callback && callback(result);
return;
}
<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"
{"contents":{"editor":{"formatOnSave":true}},"overrides":[],"keys":["editor.formatOnSave"]}
@spencercarli
spencercarli / index.js
Created February 3, 2017 15:21
react-native-meteor-offline
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 March 9, 2016 01:43
Connecting the Meteor and React Native Apps - signOut.js
// RNApp/app/containers/signOut.js
handleSignOut() {
GoogleSignin.signOut()
.then(() => {
ddpClient.logout(() => {
this.props.changedSignedIn(false);
});
})
.catch((err) => {
@spencercarli
spencercarli / signIn.js
Created March 9, 2016 01:43
Connecting the Meteor and React Native Apps - 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 March 9, 2016 01:42
Connecting the Meteor and React Native Apps - 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)
})
}