Skip to content

Instantly share code, notes, and snippets.

View jamesreggio's full-sized avatar

James Reggio jamesreggio

View GitHub Profile
@jamesreggio
jamesreggio / react-native+0.53.3.patch
Created February 28, 2018 20:01
Patch for react-native@0.53.3 to support Babel 7
patch-package
--- a/node_modules/react-native/Libraries/Alert/AlertIOS.js
+++ b/node_modules/react-native/Libraries/Alert/AlertIOS.js
@@ -122,11 +122,11 @@ class AlertIOS {
'keyboardType) and the old syntax will be removed in a future version.');
var callback = type;
- var defaultValue = message;
+ var _defaultValue = message;
RCTAlertManager.alertWithArgs({
@jamesreggio
jamesreggio / metro-minify-uglify+0.28.0.patch
Created February 28, 2018 16:08
Patch for metro-minify-uglify@0.28.0 to support Babel 7
patch-package
--- a/node_modules/metro-minify-uglify/src/minifier.js
+++ b/node_modules/metro-minify-uglify/src/minifier.js
@@ -34,7 +34,7 @@ filename)
function minify(inputCode, inputMap) {
const result = uglify.minify(inputCode, {
- mangle: { toplevel: true },
+ mangle: { toplevel: true, safari10: true },
output: {
@jamesreggio
jamesreggio / metro+0.28.0.patch
Last active February 28, 2018 19:48
Patch for metro@0.28.0 to support Babel 7
patch-package
--- a/node_modules/metro/src/babel-bridge.js
+++ b/node_modules/metro/src/babel-bridge.js
@@ -13,7 +13,7 @@
// This is a temporary migration bridge to switch between babel 6 and 7
-const IS_BABEL7 = process.env.BABEL_VERSION === '7';
+const IS_BABEL7 = true;
@jamesreggio
jamesreggio / apollo-cache-hermes-overlapping-fragments-test.ts
Created January 18, 2018 00:02
Regression test for loss of data with overlapping fragments in apollo-cache-hermes
import { GraphSnapshot } from '../../../../../src/GraphSnapshot';
import { createSnapshot } from '../../../../helpers';
describe(`overlapping fragments`, () => {
let snapshot: GraphSnapshot;
beforeAll(() => {
const cyclicRefQuery = `
query {
myDetailedBar {
...DetailedBarFragment
@jamesreggio
jamesreggio / react-native-xhr-default-withcredentials-0.50.3.patch
Created January 3, 2018 15:39
Patch to fix the default value of `XMLHttpRequest.withCredentials` option on React Native v0.50.3
From 15d2d187e745eed8c13e5132798de03920c39db0 Mon Sep 17 00:00:00 2001
From: James Reggio <james.reggio@gmail.com>
Date: Thu, 16 Nov 2017 19:58:31 -0500
Subject: [PATCH] make XMLHttpRequest.withCredentials default to false, per
spec
---
Libraries/Network/XMLHttpRequest.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@jamesreggio
jamesreggio / react-native-ios-cookie-jar-0.50.3.patch
Created January 3, 2018 15:33
Patch to revert non-standard iOS cookie jar behavior on React Native v0.50.3
@jamesreggio
jamesreggio / apollo-cache-persist-quickstart-web.js
Last active December 12, 2017 19:57
apollo-cache-persist quickstart example for web
import { InMemoryCache } from ‘apollo-cache-inmemory’;
import { persistCache } from ‘apollo-cache-persist’;
// Set up your cache.
const cache = new InMemoryCache({...});
// Set up cache persistence.
persistCache({
cache,
storage: window.localStorage,
@jamesreggio
jamesreggio / apollo-cache-persist-quickstart-rn.js
Last active December 11, 2017 18:04
apollo-cache-persist quickstart example for React Native
import { InMemoryCache } from ‘apollo-cache-inmemory’;
import { persistCache } from ‘apollo-cache-persist’;
import { AsyncStorage } from ‘react-native’;
// Set up your cache.
const cache = new InMemoryCache({...});
// Set up cache persistence.
persistCache({
cache,
@jamesreggio
jamesreggio / apollo.js
Created October 30, 2017 15:51
Mostly complete Apollo Client 2.0 initialization code
export default async (services) => {
// Links.
const contextLink = new ApolloLink((operation, forward) => {
operation.setContext(context => update(context, {
headers: {
$apply: (headers = {}) => {
headers = {
...headers,
@jamesreggio
jamesreggio / authContextLink.js
Created October 30, 2017 15:37
Setting an authorization header in Apollo Client 2.0