Skip to content

Instantly share code, notes, and snippets.

View jamesreggio's full-sized avatar

James Reggio jamesreggio

View GitHub Profile
@jamesreggio
jamesreggio / ractivejs-components-repro.htm
Created December 12, 2013 20:20
This Gist illustrates a bug in the latest version of Ractive.js (0.3.7).
<!--
This Gist illustrates a bug in the latest version of Ractive.js (0.3.7).
Download and open this file on your local machine to view the repro.
When an array is shared between the root Ractive view model and a
component (Child), the array's `_ractive.roots` cache will originally contain
`[Ractive, Child]`. However, when the array is modified from within the child,
the cache is reconstructed in the opposite order: `[Child, Ractive]`. It is
unclear whether this difference in ordering is itself a bug, or whether it
just happens to surface a bug in other code.
@jamesreggio
jamesreggio / react-sortable.htm
Last active December 31, 2015 04:39 — forked from petehunt/React sortable
This Gist demonstrates how to use an invasive jQuery plugin (UI Sortable) with the latest version of React (0.5.1). It is a simplified (and perhaps unconventional) approach to what @petehunt built in https://gist.github.com/petehunt/7882164.
<html>
<head>
<title>Test</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://fb.me/react-0.5.1.js"></script>
<script src="http://fb.me/JSXTransformer-0.5.1.js"></script>
</head>
@jamesreggio
jamesreggio / ractivejs-sortable.htm
Created December 12, 2013 21:10
This Gist demonstrates how to use an invasive jQuery plugin (UI Sortable) with the latest version of Ractive.js (0.3.7). It was built as an analogue to https://gist.github.com/petehunt/7882164, which illustrates how to pair jQuery UI Sortable with React.
<!--
This Gist demonstrates how to use an invasive jQuery plugin (UI Sortable) with
the latest version of Ractive.js (0.3.7).
It was built as an analogue to https://gist.github.com/petehunt/7882164, which
illustrates how to pair jQuery UI Sortable with React. I would contend that
Ractive.js plays more nicely with this plugin.
The key takeaway from this exercise is that you must not allow a third-party
plugin (e.g., jQuery) to change the DOM in a manner that its structure no
@jamesreggio
jamesreggio / IDYN-842-bug.md
Last active August 3, 2016 17:59
Bug report on UIScrollView or WKWebView, discovered while addressing Twitter IDYN-842

Keyboard inset adjustment double-counts toolbar height in WKWebView or UIScrollView

Since iOS 7, the navigation bar and toolbar[0] in a UINavigationController are designed to render atop the content of the current UIViewController. In order to prevent these bars from occluding the contents of the view, UINavigationController will (under certain conditions) automatically reach down the view hierarchy and adjust the insets of the primary UIScrollView, such that the content is padded by the height of these bars.

The system keyboard is also designed to occlude the bottom half of the screen by default. In most cases, this is undesirable, so the app developer is expected to subscribe to NSNotificationCenter keyboard events and adjust the UIScrollView insets themselves.

WKWebView automatically subscribes to th

@jamesreggio
jamesreggio / webview-link-probe.js
Last active August 31, 2015 21:55
Script to probe for links on a page that may not function correctly inside of a WebView control
@jamesreggio
jamesreggio / SFSafariViewController-radars.md
Last active August 17, 2018 05:32
Summary of bugs in SFSafariViewController affecting adoption within the Twitter iOS client

In the process of evaluating the suitability of SFSafariViewController (SFSVC) for use within the Twitter iOS client, I encountered a number of bugs with differing severities, all of which I filed as Radars in Apple's bug reporting tool. Here is my attempt to holistically document their impact on our ability to adopt SFSafariViewController as a replacement for our existing WebViews.

Highest Severity

The fundamental blocker is Radar

@jamesreggio
jamesreggio / debug-window-open.js
Last active September 28, 2018 08:42
Script to help diagnose popup blocker issues
// This script will help to diagnose popup blocker issues.
// Copy-paste it into your console, or include it in your development build.
//
// When you make a call to window.open(), this script will check whether the
// most recent user input event happened on the same tick. (If not, a
// breakpoint is triggered and an explanation is written to the console.)
//
// You can manually call window.debugOpen() at any time to determine the
// whether it's safe to insert a call to window.open() in the current code.
//
@jamesreggio
jamesreggio / index.ios.js
Created February 6, 2017 22:31
Repro for an uninitialized memory issue in React Native 0.41.1
// The underlying issue pertains to uninitialized memory and is inherently non-deterministic.
// This will consistently reproduce for me using React Native 0.41.1 on iOS 9.3, but it will not reproduce on iOS 10.2.
// If the app launches and does not immediately display a redbox with an error, the bug did not reproduce.
import React, { Component } from 'react';
import { AppRegistry, View } from 'react-native';
export default class App extends Component {
constructor() {
super();
@jamesreggio
jamesreggio / index.ios.js
Created July 28, 2017 13:28
Repro for an issue with frame calculations in VirtualizedList in React Native 0.46.4
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
FlatList,
Text,
View
} from 'react-native';
const ITEMS = 100;
@jamesreggio
jamesreggio / authContextLink.js
Created October 30, 2017 15:37
Setting an authorization header in Apollo Client 2.0