Skip to content

Instantly share code, notes, and snippets.

@eddiewebb
eddiewebb / downloadArtifacts.sh
Last active March 18, 2022 09:50
Download CircleCI Artifacts with directory structure
#!/usr/bin/env bash
#
# Download all artitacts for given build, mimicing structure locally.
#
# Batch size is slighly misleading, as it;s only how many URLs to attempt before momentary pause
#
# Can be used on CCI builds with parallelism and will only download the files for matcing index.
#
#
USAGE="$0 username/repo 123 [bitbucket] [batch_size]"
@gpeal
gpeal / SimpleDemo.kt
Last active August 28, 2018 17:54
Airbnb MvRx Early Look
data class SimpleDemoState(val listing: Async<Listing> = Uninitialized)
class SimpleDemoViewModel(override val initialState: SimpleDemoState) : MvRxViewModel<SimpleDemoState>() {
init {
fetchListing()
}
private fun fetchListing() {
// This automatically fires off a request and maps its response to Async<Listing>
// which is a sealed class and can be: Unitialized, Loading, Success, and Fail.
android {
defaultConfig {
}
signingConfigs {
release {
val signing = project.rootProject.properties("signing.properties")
if (signing != null) {
@yasiralijaved
yasiralijaved / build.gradle
Last active July 4, 2018 13:07
app level build.gradle file to create Gradle's custom tasks "inernalQADist" and "externalQADist" that Jenkins calls to build and distribute the apk and also send the notification to a Slack Channel for Internal and External QA Teams
// Gradle Plugin to publish APK to Google PlayStore right from the Gradle Task.
// https://github.com/Triple-T/gradle-play-publisher
apply plugin: 'com.github.triplet.play'
// Fabric.io Plugin
apply plugin: 'io.fabric'
// Slack Plugin For Gradle. https://github.com/Mindera/gradle-slack-plugin
apply plugin: 'com.mindera.gradle.slack'
@dkhmelenko
dkhmelenko / analyze_apk_size.sh
Created March 6, 2018 22:15
Script for analyzing Android APK size
PATH_TO_APK=$1
APK_THRESHOLD=$2
echo "Analyze APK size command"
NEW_APK_SIZE=`expr $(stat -c%s PATH_TO_APK) / 1024`
echo "APK size is now "$NEW_APK_SIZE" KB"
if [[ $NEW_APK_SIZE -lt $APK_THRESHOLD ]]; then
echo "APK file is less than "$APK_THRESHOLD" KB. OK"
@Override
public void onStart() {
setJsBridgeClassName("android.support.test.espresso.web.bridge.JavaScriptBridge");
super.onStart();
/*
* The orchestrator cannot collect the list of tests as it is running in a different process
* than the test app. On first run, the Orchestrator will ask AJUR to list the tests
* out that would be run for a given class parameter. AJUR will then be successively
* called with whatever it passes back to the orchestratorListener.
@anuragdhunna
anuragdhunna / SingleTextView.java
Created February 5, 2018 14:03
Single Text View with Multiple Click Events
private static void singleTextView(TextView textView, final String userName, String status, final String songName) {
SpannableStringBuilder spanText = new SpannableStringBuilder();
spanText.append(userName);
spanText.setSpan(new ClickableSpan() {
@Override
public void onClick(View widget) {
// On Click Action
@mohamedebrahim96
mohamedebrahim96 / activity_main2.xml
Last active December 12, 2018 23:10
The function of the button at the center is to call an activity and the TabLayout will be place at the bottom of the screen.
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.vacuum.app.cinema.MainActivity">
<!--SOME CODE FOR MY AppBarLayout-->
<!--SOME CODE FOR MY ToolBar-->
public class Authorization {
@SerializedName("user_id")
@Expose
private String userId;
@SerializedName("token")
@Expose
private String token;
public class AuthorizationInterceptor implements Interceptor {
private ApiService apiService;
private Session session;
public AuthorizationInterceptor(ApiService apiService, Session session) {
this.apiService = apiService;
this.session = session;
}
@Override