Skip to content

Instantly share code, notes, and snippets.

View kaeawc's full-sized avatar
🤓
Probably coding

Jason Pearson kaeawc

🤓
Probably coding
View GitHub Profile
@kaeawc
kaeawc / ExampleUnitTest.kt
Created June 14, 2020 03:30
The example test file that Android Studio creates
package dev.jasonpearson.testing
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
@kaeawc
kaeawc / MotionLayoutExtensions.kt
Created January 17, 2020 16:35
MotionLayout extension functions to help aid transitions and debugging
import android.content.Context
import androidx.constraintlayout.motion.widget.MotionLayout
import androidx.constraintlayout.motion.widget.MotionScene
import timber.log.Timber
fun MotionLayout.after(completion: () -> Unit) {
Timber.v("Started listening, currently at ${currentState.resName(context)}")
this.setTransitionListener(object: MotionLayout.TransitionListener {
@kaeawc
kaeawc / android_sdk_licenses.sh
Created December 20, 2018 21:14
Making Circle CI not suck
#!/usr/bin/env bash
mkdir -p /opt/android/sdk/licenses || true
cp ./licenses/* /opt/android/sdk/licenses/
yes | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;28.0.3"
@kaeawc
kaeawc / sblack.js
Created October 22, 2018 21:56
Black Slack Theme
document.addEventListener('DOMContentLoaded', function() {
$.ajax({
url: 'https://raw.githubusercontent.com/laCour/slack-night-mode/master/css/raw/black.css',
success: function(css) {
$("<style></style>").appendTo('head').html(css);
}
});
});
@kaeawc
kaeawc / LaunchActivity.kt
Created October 2, 2018 03:56
Diposer implementation
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.OnLifecycleEvent
import io.reactivex.Flowable
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import timber.log.Timber
// Just a small snippet of an SDK
public final class ChatSDK {
private static final Handler sUIThreadHandler
public static void connect(SDKConnectCallback handler) {
// do some weird obfuscated internal SDK processing stuff here
User user = connectAndGetUser();
if (sUIThreadHandler != null) {
@kaeawc
kaeawc / codecov.yml
Last active December 20, 2021 13:15
Jacoco settings for multi module multi flavor Kotlin Android app
codecov:
branch: master
bot: null
coverage:
precision: 2
round: down
range: "70...100"
status:
@kaeawc
kaeawc / gist:25ad5a2c44dad58bc8323a4848270952
Created June 10, 2016 21:07
WSGI error attempting to log unicode
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python3.4/dist-packages/newrelic-2.60.0.46/newrelic/hooks/framework_flask.py", line 30, in _nr_wrapper_handler_
return wrapped(*args, **kwargs)
File "/api/services/playground/controllers/search.py", line 67, in test_unicode_stuff
File "/usr/lib/python3.4/logging/__init__.py", line 1596, in info
self.log(INFO, msg, *args, **kwargs)
import android.util.Log;
import com.squareup.leakcanary.AnalysisResult;
import com.squareup.leakcanary.DisplayLeakService;
import com.squareup.leakcanary.HeapDump;
import retrofit.RestAdapter;
import retrofit.RetrofitError;
import retrofit.http.Multipart;
import retrofit.http.POST;
import retrofit.http.Part;
import retrofit.mime.TypedFile;
@kaeawc
kaeawc / git-repo-download.gradle
Last active August 29, 2015 14:15
Download a git repository as a Gradle task
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "de.undercouch:gradle-download-task:1.0"
}
}
apply plugin: "download-task"