Skip to content

Instantly share code, notes, and snippets.

@just-kip
just-kip / test.kt
Created January 19, 2018 07:27
RxJava repeatWhen example
View test.kt
@Test
fun test_repeating_api_request() {
val scheduler = TestScheduler()
var apiRequestCount = 0
val apiRequest = {
if (apiRequestCount < 5) {
apiRequestCount++
Observable.just("wait")
@just-kip
just-kip / MainActivity.java
Created May 11, 2016 13:43
OkHttp3 asyncTask example
View MainActivity.java
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class MainActivity extends AppCompatActivity {
View test.gradle
def hello = 'Hello World!!!'
ext {
HELLO = hello
}
View gist:3d382d890e63c32a6b2f
Get APK from Play Market: https://chrome.google.com/webstore/detail/apk-downloader/cgihflhdpokeobcfimliamffejfnmfii
cd <sdk_folder>/build-tools/<sdk_version>
./aapt dump badging <apk>
View decodebitmap.kt
fun crop(file: String) : String{
var bitmap = decode(file)
var h = bitmap.getHeight()
var w = bitmap.getWidth()
val minSideSize = Math.min(h, w)
var x = (w - minSideSize) / 2
var y = (h - minSideSize) / 2
val exif = ExifInterface(file)
View oh-my-zsh conf
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="daveverwer"
# Example aliases
View JellyBeanSpanFixTextView.java
// Copyright 2012 Pierre-Yves Ricau
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT