Skip to content

Instantly share code, notes, and snippets.

View wzieba's full-sized avatar
🏎️

Wojciech Zięba wzieba

🏎️
View GitHub Profile
package pl.krasiniak.krachapp_beta;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@wzieba
wzieba / Boxer.java
Last active October 7, 2018 07:56 — forked from pasmat/Boxer.java
Data-binded values that are boxed(such as ones that come from Kotlin, as there's no primitive types in Kotlin..) requires safe unboxing, so there's no NPE(null pointer exception) when binding data. Theres a method for this safeUnbox inside Android SDK, however this doesn't support two-way data binding. Therefore we have to define these two-way s…
package fi.matalamaki.util;
import androidx.databinding.InverseMethod;
/**
* Data-binded values that are boxed(such as ones that come from Kotlin,
* as there's no primitive types in Kotlin..) requires safe unboxing,
* so there's no NPE(null pointer exception) when binding data.
*
* Theres a method for this safeUnbox inside Android SDK,
@wzieba
wzieba / action.yml
Last active October 25, 2019 08:41
name: 'Firebase Distribution'
description: 'GitHub Action that uploads artifacts to Firebase Distribution'
author: 'Wojciech Zięba <@wzieba>'
inputs:
appId:
description: 'App id can be found on the General Settings page'
required: true
token:
description: 'Upload token - see Firebase CLI Reference'
required: true
FROM node:12.10.0-alpine
WORKDIR /app
COPY . /app
RUN npm install -g firebase-tools \
&& apk update \
&& apk add git
#!/bin/sh
MESSAGE="";
if [[ -z ${INPUT_RELEASENOTES} ]]; then
MESSAGE="$(git log -1 --pretty=short)"
else
MESSAGE=${INPUT_RELEASENOTES}
fi
firebase appdistribution:distribute "$INPUT_FILE" --app "$INPUT_APPID" --token "$INPUT_TOKEN" --groups "$INPUT_GROUPS" --release-notes "$MESSAGE"
@wzieba
wzieba / main.yml
Last active October 25, 2019 08:41
name: Example workflow for Firebase Distribution action
on: [push]
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Get sample .apk for test purposes
run: wget https://github.com/appium/appium/raw/master/sample-code/apps/ApiDemos-debug.apk
@wzieba
wzieba / saved_line
Created July 20, 2020 13:34
1. string escape sequences
foo\nbar
fun main() {
val stringAssignedInCode = "foo\nbar"
val stringStoredInFile: String = this::class.java.classLoader.getResource("saved_line")!!.readText()
assertThat(stringAssignedInCode).isEqualTo(stringStoredInFile)
}
fun main() {
val stringAssignedInCode = "foo\nbar"
val stringStoredInFile: String = this::class.java.classLoader.getResource("saved_line")!!.readText()
.replace("\\n", "\n")
assertThat(stringAssignedInCode).isEqualTo(stringStoredInFile)
}
fun main() {
val stringAssignedInCode = "foo\nbar"
val plainStringFromFile: String = this::class.java.classLoader.getResource("saved_line")!!.readText()
val stringSimplyReplaced = plainStringFromFile.replace("\\n", "\n")
val stringUnescapedWithApacheCommons = StringEscapeUtils.unescapeJava(plainStringFromFile)