Skip to content

Instantly share code, notes, and snippets.

View majirosstefan's full-sized avatar
🏠
Working from home

Stefan Majiros majirosstefan

🏠
Working from home
View GitHub Profile
@majirosstefan
majirosstefan / TS_TypeWithMutualExclusion.ts
Created February 25, 2024 10:40
taken from Stripe (RN lib)
declare type ClientSecretParams = {
paymentIntentClientSecret: string;
setupIntentClientSecret?: undefined;
} | {
setupIntentClientSecret: string;
paymentIntentClientSecret?: undefined;
};
@majirosstefan
majirosstefan / country-bounding-boxes.py
Created September 7, 2023 10:58 — forked from graydon/country-bounding-boxes.py
country bounding boxes
# extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
# under public domain terms
country_bounding_boxes = {
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)),
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)),
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)),
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)),
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)),
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)),
"ConfigureESCustom": {
"Type": "Custom::ConfigureES",
"Properties": {
"ServiceToken": {
"Fn::GetAtt": ["ConfigureES", "Arn"]
}
}
},
"ConfigureES": {
"Type": "AWS::Lambda::Function",
import RNFetchBlob from 'rn-fetch-blob';
const DocumentDir = RNFetchBlob.fs.dirs.DocumentDir;
const storagePath = `${DocumentDir}/persistStore`;
const encoding = 'utf8';
const toFileName = (name: string) => name.split(':').join('-');
const fromFileName = (name: string) => name.split('-').join(':');
const pathForKey = (key: string) => `${storagePath}/${toFileName(key)}`;
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width," />
<style>
body {
margin: 0;
}
.container {
position: relative;
@majirosstefan
majirosstefan / expo-notifications+0.14.1.patch
Last active August 9, 2022 13:22
Expo Push Notification & AWS Pinpoint & AWS SNS Compatibility - Patch for React Native app that provides compatibility between AWS Pinpoint (used on serverside) and Expo-Notification library (used in mobile app).
diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/JSONNotificationContentBuilder.java b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/JSONNotificationContentBuilder.java
index 0af7fe0..d7c0946 100644
--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/JSONNotificationContentBuilder.java
+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/JSONNotificationContentBuilder.java
@@ -16,6 +16,10 @@ import expo.modules.notifications.notifications.model.NotificationContent;
public class JSONNotificationContentBuilder extends NotificationContent.Builder {
private static final String TITLE_KEY = "title";
private static final String TEXT_KEY = "message";
+
+ private static final String TITLE_PINPOINT_KEY = "pinpoint.notification.title";
@majirosstefan
majirosstefan / AWS Amplify CI support for React Native in Github Actions
Created July 5, 2022 14:00
AWS Amplify: Support for CI w/ React Native in Github Actions
...rest of your.yaml
# do not forget to add secrets into Github Actions!
- name: 🚀 Configure backend environment
run: |
yarn global add @aws-amplify/cli@5.1.0
which amplify
@majirosstefan
majirosstefan / CameraRollModule.java
Last active May 18, 2022 10:21
react-native-cameraroll: Support for Android 10, 11, 12 // scoped storage. Saves images into Photos or Gallery app. Used together with patch-package.
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.reactnativecommunity.cameraroll;
import android.content.ContentResolver;
@majirosstefan
majirosstefan / React Native - iOS EMFILE: too many open files + Sentry, NVM Fix
Created April 26, 2022 19:05
For "react-native": "~0.63.4". This gist contains code for "Bundle React Native code and images" build phase
export SENTRY_LOG_LEVEL=debug
export EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"
# you can set here sentry_properties, but I am not doing so as I am using global .sentryclirc file
#export PROJECT_ROOT=../
export NODE_BINARY=$(which node)
../node_modules/@sentry/cli/bin/sentry-cli react-native xcode ../node_modules/react-native/scripts/react-native-xcode.sh --force-foreground
# uncomment line below if you are coming from expo
# Firebase Config using base64
echo "Injecting secrets..."
echo "Updating Google JSON"
echo $GoogleServicesJson | base64 --decode >"$APPCENTER_SOURCE_DIRECTORY/android/app/google-services.json"
echo "Updating Google plist"
echo $GoogleServicesPlist | base64 --decode >"$APPCENTER_SOURCE_DIRECTORY/ios/GoogleService-Info.plist"
echo "Finished injecting secrets..."
echo "Google Services"
cat "$APPCENTER_SOURCE_DIRECTORY/ios/GoogleService-Info.plist"