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
generate_sendgrid_post_data() {
cat <<EOF
{
"personalizations":
[
{
"to": [{"email": "$TO_MAIL"}],
"dynamic_template_data": $templateData
}
],
echo "Cancelling Appcenter Build"
echo $API_TOKEN
echo $APP_NAME
echo $APPCENTER_BUILD_ID
curl -iv "https://appcenter.ms/api/v0.1/apps/$OWNER_NAME/$APP_NAME/builds/$APPCENTER_BUILD_ID" \
-X PATCH \
-d "{\"status\":\"cancelling\"}" \
--header 'Content-Type: application/json' \
# #!/usr/bin/env bash
# mocking variables, when running locally
[email protected]
ORG=majirosstefan
TO_MAIL=$RecipientMail
APP_NAME=$AppName
SENDGRID_TEMPLATE_ID=$SendgridTemplateId
BUILD_URL=https://appcenter.ms/orgs/$ORG/apps/$APP_NAME/build/branches/$APPCENTER_BRANCH/builds/$APPCENTER_BUILD_ID
@majirosstefan
majirosstefan / buildgradle-logger.gradle
Created September 19, 2021 14:39
how to log variables in build.gradle - part of blog post (e2e tests on apccenter with cavy) at stefan-majiros.com
...
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
// put this in the end of file
// logging Gradle Variables - Microsoft approach gives null
@majirosstefan
majirosstefan / ms-android-signing-recommendation.gradle
Created September 19, 2021 14:40
part of blog post at stefan-majiros.com
android {
signingConfigs {
releaseSigningConfig {
storeFile rootProject.file("app/testapp.jks")
storePassword System.getProperty("APPCENTER_KEYSTORE_PASSWORD")
keyAlias System.getProperty("APPCENTER_KEY_ALIAS")
keyPassword System.getProperty("APPCENTER_KEY_PASSWORD")
}
}
@majirosstefan
majirosstefan / cavy-patch.patch
Created September 19, 2021 15:18
Patch for Cavy (E2E test framework for React Native) that fixes the bug when CavyTests crashed the app, but CI (Appcenter) would keep hanging
diff --git a/node_modules/cavy-cli/cavy.js b/node_modules/cavy-cli/cavy.js
index ad2c7e2..8dcc2f1 100755
--- a/node_modules/cavy-cli/cavy.js
+++ b/node_modules/cavy-cli/cavy.js
@@ -34,7 +34,9 @@ function test(cmd) {
const outputAsXml = cmd.xml;
const dev = cmd.dev;
const bootTimeout = cmd.bootTimeout;
- runTests(commandName, entryFile, skipbuild, dev, outputAsXml, bootTimeout, args);
+ const allTestRunTimeout = cmd.allTestRunTimeout;
// import AsyncStorage
// from '@react-native-async-storage/async-storage';
const LOCALE_KEY = 'locale';
export const storeLocale = async locale => {
try {
console.log('PERSIST LOCALE', locale);
await AsyncStorage.setItem(LOCALE_KEY, locale);
} catch (error) {
{
"CERTIFICATES": "Certificates",
"NO_CERTS_IN_APP_TITLE": "You have no certificates in the application.",
"NO_CERTS_IN_APP_DESCRIPTION": "Add the certificate by scanning the QR code using device camera.",
"SCAN_QR_FROM_PAPER": "Scan new QR code",
"CERTIFICATE_COULD_NOT_BE_RECOGNIZED_TITLE": "This certificate could not be recognized.",
"CERTIFICATE_COULD_NOT_BE_RECOGNIZED_DESCRIPTION": "Please scan other certificate.",
"SCAN_AGAIN": "Scan QR code again",
"CERTIFICATE_RECOGNIZED_TITLE": "was recognized sucessfully.",
"MEDICAL_PRODUCT": "Medical Product",
import i18n from 'i18n-js';
import memoize from 'lodash.memoize';
// 💖 we will use translate in our components
export const translate = memoize((key, config) => i18n.t(key, config));
export const currentLocale = () => i18n.locale;
// 💖 this is function responsinble for changing locale
export const setI18nConfig = async languageTag => {
export const translationFileMappings = {
// lazy requires (metro bundler does not support symlinks)
af: () => require('./translations/af.json'),
am: () => require('./translations/am.json'),
az: () => require('./translations/az.json'),
be: () => require('./translations/be.json'),
bg: () => require('./translations/bg.json'),
bn: () => require('./translations/bn.json'),
bs: () => require('./translations/bs.json'),
ca: () => require('./translations/ca.json'),