Skip to content

Instantly share code, notes, and snippets.

View iregina's full-sized avatar
🏊‍♀️

Regina Wong iregina

🏊‍♀️
View GitHub Profile
@iregina
iregina / capturesnapshot
Created April 22, 2025 17:37
how we capture the snapshot on iOS - Shopify MobileBridge
final class TransportableView: RCTView {
func takeSnapshot() {
removeSnapshot()
snapshot = snapshotView(afterScreenUpdates: false)
if let snapshot {
addSubview(snapshot)
snapshot.frame = frame
}
}
}
@iregina
iregina / transportableview
Created April 22, 2025 17:36
Simple example of TransportableView on iOS - Shopify MobileBridge
final class TransportableView: RCTView {
func transportTo(_ transportView: TransportableView) {
if let transportedView = subviews.first {
transportedView.removeFromSuperview()
transportView.insertSubview(transportedView, at: 0)
bridge.uiManager?.setSize(frame.size, for: transportedView)
}
}
}
@iregina
iregina / preventingtextselection
Created April 22, 2025 17:35
Preventing Text Selection - Shopify MobileBridge
*:not(input):not(textarea):not(select) {
-webkit-touch-callout: none;
-webkit-user-select: none;
}
@iregina
iregina / disablingzoom.js
Created April 22, 2025 17:33
Disabling Zoom - Shopify MobileBridge
document.addEventListener('DOMContentLoaded', (event) => {
const meta = document.createElement('meta');
meta.setAttribute('name', 'viewport');
meta.setAttribute('content', 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0, viewport-fit=cover');
document.getElementsByTagName('head')[0].appendChild(meta);
});
// the tangents are computed when the mesh is created, and passed as an attribute
attribute vec3 tangent;
vec3 lookDirection = normalize(position.xyz - cameraPosition);
vec3 offset = cross(lookDirection, tangent);
vec3 adjustedPosition = position.xyz + normalize(offset) * thickness;
@iregina
iregina / capybara cheat sheet
Created February 10, 2016 18:25 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')