Skip to content

Instantly share code, notes, and snippets.

View Kamil-Kaminski's full-sized avatar

Kamil Kamiński Kamil-Kaminski

View GitHub Profile
@Kamil-Kaminski
Kamil-Kaminski / react.gradle
Last active March 6, 2018 13:34
Fixed react.gradle for release build for bitrise
import org.apache.tools.ant.taskdefs.condition.Os
def config = project.hasProperty("react") ? project.react : [];
def cliPath = config.cliPath ?: "node_modules/react-native/local-cli/cli.js"
def bundleAssetName = config.bundleAssetName ?: "index.android.bundle"
def entryFile = config.entryFile ?: "index.android.js"
// because elvis operator
def elvisFile(thing) {
return thing ? file(thing) : null;
}
def reactRoot = elvisFile(config.root) ?: file("../../")
@Kamil-Kaminski
Kamil-Kaminski / ApplyExample.kt
Last active September 5, 2018 20:07
This sample shows how to use kotlin .apply() based on fragment instantiating example. There are 4 examples: first in Java, second in Kotlin without apply(), third in Kotlin with one apply(), and last in Kotlin with two apply().
// Java
public static DetailsFragment newInstance(int id) {
Bundle arguments = new Bundle();
arguments.putInt("id", id);
DetailsFragment fragment = new DetailsFragment();
fragment.setArguments(arguments);
return fragment;
}