Skip to content

Instantly share code, notes, and snippets.

View mpiannucci's full-sized avatar

Matthew Iannucci mpiannucci

View GitHub Profile
@shirakaba
shirakaba / Creating an Expo app in 2023.md
Created July 12, 2023 08:08
Creating an Expo app in 2023

Creating an Expo app in 2023

12th July, 2023. I'm going to try creating an iOS app called Paranovel, using Expo. My environment for mobile app dev (Xcode, Ruby, etc.) should be in reasonably good shape already as I frequently develop with React Native and NativeScript.

Creating the app

Go to https://docs.expo.dev, and see the Quick Start: npx create-expo-app paranovel

This runs with no problem, then I get this macOS system popup:

@JLarky
JLarky / IsolateCSS.tsx
Last active July 10, 2023 09:23
How to use shadow dom to isolate CSS of React component https://twitter.com/JLarky/status/1657989891526123520
export function IsolateCSS(props: { children: React.ReactNode }) {
const onceRef = useRef(false);
const [shadowRoot, setShadowRoot] = useState<ShadowRoot>();
const ref = useCallback((ref: HTMLDivElement | null) => {
if (ref && onceRef.current === false) {
onceRef.current = true;
setShadowRoot(ref.attachShadow({ mode: 'open' }));
}
}, []);
@kwilcox
kwilcox / intake.py
Created March 1, 2023 20:28
xpublish-intake
import yaml
import logging
from typing import Sequence
from starlette.routing import NoMatchFound
from fastapi import APIRouter, Depends, Response, Request
from xpublish.utils.api import DATASET_ID_ATTR_KEY
from xpublish.plugins import Dependencies, Plugin, hookimpl
@newhouseb
newhouseb / index.ts
Created July 29, 2021 14:13
Rust + AWS Lambda + Pulumi
/*
* Lambda/Web configuration
*/
const robocontrollerRole = new aws.iam.Role("robocontrollerRole", {
assumeRolePolicy: aws.iam.assumeRolePolicyForPrincipal({ Service: "lambda.amazonaws.com" }),
});
const lambdaRole = new aws.iam.RolePolicyAttachment("executeLambdaRoleAttach", {
role: robocontrollerRole,
@shirakaba
shirakaba / README.md
Last active November 17, 2023 00:52
GUI-based debugging of iOS/macOS Rust projects in Xcode

Here's how to get your environment set up to:

  1. Develop iOS and Android apps using Rust.
  2. Enable GUI debugging of Rust projects in Xcode.

If you just want to enable GUI debugging of macOS Rust projects in Xcode, I'm not actually sure whether you need cargo-mobile at all. But one benefit of installing it is that it automatically installs rust-xcode-plugin for you, giving you syntax highlighting of Rust sources in Xcode.

Prerequisites

cargo-mobile

@MegaMaddin
MegaMaddin / react-native+0.64.1.patch
Created May 13, 2021 14:16
[react-native][iOS] Trigger onRequestClose when swiping down a pageSheet
diff --git a/node_modules/react-native/React/Views/RCTModalHostView.h b/node_modules/react-native/React/Views/RCTModalHostView.h
index c54c1c6..a5c49d1 100644
--- a/node_modules/react-native/React/Views/RCTModalHostView.h
+++ b/node_modules/react-native/React/Views/RCTModalHostView.h
@@ -16,7 +16,7 @@
@protocol RCTModalHostViewInteractor;
-@interface RCTModalHostView : UIView <RCTInvalidating>
+@interface RCTModalHostView : UIView <RCTInvalidating, UIAdaptivePresentationControllerDelegate>
@rmg55
rmg55 / Warp_Xarray.ipynb
Last active July 26, 2022 10:21
Wrapping Raster to Xarray+Dask
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Semnodime
Semnodime / imreconstruct.py
Last active September 16, 2022 21:46
MatLab imreconstruct in OpenCV Python for Morphological Reconstruction
import cv2
import numpy as np
def imreconstruct(marker: np.ndarray, mask: np.ndarray, radius: int = 1):
"""Iteratively expand the markers white keeping them limited by the mask during each iteration.
:param marker: Grayscale image where initial seed is white on black background.
:param mask: Grayscale mask where the valid area is white on black background.
:param radius Can be increased to improve expansion speed while causing decreased isolation from nearby areas.
@chockenberry
chockenberry / Debug.swift
Last active April 11, 2024 13:22
Debug and release logging in Swift that's reminiscent of NSLog()
//
// Debug.swift
//
// Created by Craig Hockenberry on 3/15/17.
// Updated by Craig Hockenberry on 2/20/24.
// Usage:
//
// SplineReticulationManager.swift:
//
@mourner
mourner / shadows.html
Created August 17, 2018 20:52
Experimental Mapbox GL shadows (for custom-layers branch)
<!DOCTYPE html>
<html>
<head>
<title>Mapbox GL JS debug page</title>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<link rel='stylesheet' href='/dist/mapbox-gl.css' />
<style>
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }