Skip to content

Instantly share code, notes, and snippets.

View es0329's full-sized avatar

Eric es0329

View GitHub Profile
@es0329
es0329 / emulator-install-using-avdmanager.md
Created October 10, 2019 13:19 — forked from mrk-han/emulator-install-using-avdmanager.md
Installing and creating Emulators with AVDMANAGER (For Continuous Integration Server or Local Use)

Install and Create Emulators using AVDMANAGER and SDKMANAGER

About

  • The goal of this gist is to quickly pre-install a range of system images to provide our project teams the ability to run emulators on a range of API levels, from API 19 to API 28.
    • These can be run locally or on the base build agent.
  • Note: X86 is the fastest architecture for emulators, though x86_64 would probably be better to test against because most phones are 64 bit now.
  • We create two sets of emulators here, one set with pixel hardware emulation and one set with default oem emulation.

See: Google Documentation on Start the emulator from the command line for more info

@es0329
es0329 / EndlessRecyclerOnScrollListener.java
Created May 7, 2019 19:18 — forked from pratikbutani/EndlessRecyclerOnScrollListener.java
Endless RecyclerView OnScrollListener for pagination
public abstract class EndlessRecyclerViewScrollListener extends RecyclerView.OnScrollListener {
// The minimum amount of items to have below your current scroll position
// before loading more.
private int visibleThreshold = 5;
// The current offset index of data you have loaded
private int currentPage = 0;
// The total number of items in the dataset after the last load
private int previousTotalItemCount = 0;
@es0329
es0329 / gist:df4d225ef98ed4e32e1b917c192108c1
Created February 4, 2019 15:55
## Role Offerscurl "https://obsidian.wombang.com/v1/workflow/role-offers/42/?filter%5Baccount_id%5D=58&filter%5Bstate%5D=open&include=locked-spot,locked-spot.tasks" \ -H 'Content-Type: application/vnd.api+json' \ -H 'Authorization: Bearer ***** Hidden credentials *****' \ -H 'X-IZEA-Account-ID: 58'
{
"data": {
"id": "42",
"type": "workflow/role-offers",
"attributes": {
"current": true,
"side": "buy",
"state": "open",
"system-terms-accepted-at": null,
"transactions": {
@es0329
es0329 / build.gradle
Created December 22, 2018 02:45
Gradle task to create a single Ktor Jar with all dependencies.
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Fat Jar',
'Implementation-Version': version,
'Main-Class': 'io.ktor.server.netty.EngineMain'
}
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
@es0329
es0329 / ComputeHash.kt
Created August 2, 2018 14:47
Compute hash for arbitrary input.
import android.util.Base64
import java.security.MessageDigest
fun computeHash(input: String, algorithm: String = "SHA-256"): String {
// https://developer.android.com/reference/java/security/MessageDigest
val messageDigest = MessageDigest.getInstance(algorithm).apply {
update(input.toByteArray())
}
return Base64.encodeToString(messageDigest.digest(), Base64.DEFAULT)
@es0329
es0329 / build.gradle
Created February 16, 2018 05:59
Gradle for Kotlin/Native
// plugin requirements
buildscript {
repositories {
mavenCentral()
maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:0.6"
}
}

Keybase proof

I hereby claim:

  • I am es0329 on github.
  • I am es0329 (https://keybase.io/es0329) on keybase.
  • I have a public key ASCDy3EE-Sm-YSzocYT5HDTr01lEGwTMQvSDkvEiKFTJKAo

To claim this, I am signing this object:

@es0329
es0329 / FooProviderConfig.java
Created July 22, 2016 16:51
SQLite database and upgrade attempt using SimpleSQLProvider.
package com.es0329.sqlite;
import ckm.simple.sql_provider.UpgradeScript;
import ckm.simple.sql_provider.annotation.ProviderConfig;
import ckm.simple.sql_provider.annotation.SimpleSQLConfig;
import com.es0329.sqlite.R;
@SimpleSQLConfig(
name = "FooProvider",
authority = "com.es0329.sqlite.AUTHORITY",
@es0329
es0329 / League.java
Last active May 21, 2016 17:50
Moshi JSON parsing.
public final class League {
public final String franchise_id;
public final String url;
public final String name;
public final String franchise_name;
public League(String franchise_id, String url, String name, String franchise_name) {
this.franchise_id = franchise_id;
this.url = url;
this.name = name;
@es0329
es0329 / circle.yml
Last active March 16, 2017 16:20
Experimenting with CircleCI and android-23, build-tools-23.0.3
#
# Build configuration for Circle CI
#
general:
artifacts:
- /home/ubuntu/Fool-Android/app/build/outputs/apk/
machine:
environment: