Skip to content

Instantly share code, notes, and snippets.

View ripzery's full-sized avatar
🎯
Focusing

PS ripzery

🎯
Focusing
  • Thailand
View GitHub Profile
class SomeActivity : Activity() {
val f: Foo by lazy { createFoo() } // put your initialization block here
fun onCreate(bundle: Bundle?) {
f.foo() // f will be created here and it's a val so you can't change it
f // or you can call a getter just to initialize it
}
fun createFoo() = Foo(this)
// this is useful when you need a context after the activity is created
@ripzery
ripzery / log_gcm_structure
Last active October 18, 2016 23:53
gcm structure from tsl which uses notification payload
10-18 23:58:21.170 25945-26010/com.socket9.thetsl D/MyGRcmListenerService: From: 197311876504
10-18 23:58:21.172 25945-26010/com.socket9.thetsl I/MyGcmListenerService: Bundle[{google.sent_time=1476809900797, type=SERVICE BOOKING, google.message_id=0:1476809900806468%43ae439143ae4391, notification=Bundle[{body=รถยนต์หมายเลขทะเบียน ปดก-2558 ได้นัดหมายเข้าใช้บริการที่ TSL Auto Service ในวันที่ 21/09/2016 เวลา 15:19:00 น., title=SERVICE BOOKING}], message={"th_data":{"date":"Wednesday, September 21, 2016","time":"3:19 pm","type":"บริการแบบ A","branch":"ศูนย์บริการภูเก็ต"},"th":"รถยนต์หมายเลขทะเบียน ปดก-2558 ได้นัดหมายเข้าใช้บริการที่ TSL Auto Service ในวันที่ 21\/09\/2016 เวลา 15:19:00 น.","en_data":{"date":"Wednesday, September 21, 2016","time":"3:19 pm","type":"Service A","branch":"Phuket Service Center"},"en":"Date confirm 21\/09\/2016 Time 15:19:00"}, collapse_key=com.socket9.thetsl}]
10-18 23:58:21.173 25945-26010/com.socket9.thetsl I/MyGcmListenerService: รถยนต์หมายเลขทะเบียน ปดก-2558 ได้นัดหมายเข้าใช้บริกา
@sohamtriveous
sohamtriveous / build.gradle
Last active February 1, 2017 16:36
A sample RxJava-Android and retrolambda gradle configuration for Android Studio on Mac OS.
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.databaseexample"
minSdkVersion 14
targetSdkVersion 22
@andreaseger
andreaseger / miniuploader.html
Created July 20, 2011 14:42
a very compact drag and drop image uploader written in html5 an javascript
<!DOCTYPE html>
<!-- This is the shortest Image Uploader ever :)
And you can even make it shorter if you don't
want all the drag'n drop thing. -->
<!--
AUTHOR: @paulrouget <paul@mozilla.com>
LICENSE:
@gsoltis
gsoltis / RxFirebase.java
Last active March 7, 2019 00:27
RxJava Bindings for Firebase
package com.firebase.client;
import com.firebase.client.core.Constants;
import rx.Observable;
import rx.Subscriber;
import rx.functions.Action0;
import rx.functions.Func1;
import rx.subscriptions.Subscriptions;
public class RxFirebase {
@polbins
polbins / README.md
Last active September 6, 2019 11:08
Android Response Caching using Retrofit 1.9 + OkHttp 2.2

Android REST Controller with Cache-Control

Android REST Controller with Simple Cache Control Headers using Retrofit 1.9.0 + OkHttp 2.2.0

@amulyakhare
amulyakhare / icon-gen.sh
Created August 27, 2015 10:53
Bash script to update the application icon of our internal release builds to include a visual marker and version number on the icon for convenience of the testers.
#!/bin/bash
# $> bash icon-gen.sh <version label> <project dir> <script sub-dir>
#
#
# process_icon version_num res_sub_dir current_work_dir target_dir
process_icon(){
image_width=`identify -format %[fx:w] $3/app/src/main/res/drawable-$2/com_garena_shopee_logo_shopee_launcher.png` && let "image_width-=4"
image_height=`identify -format %[fx:h] $3/app/src/main/res/drawable-$2/com_garena_shopee_logo_shopee_launcher.png` && let "image_height-=4"
convert $3$4/marker.png -background '#0000' -fill white -gravity south -size 137x16 caption:$1 -composite -resize $image_widthx$image_height $3$4/intermediate.png
convert -composite -gravity center $3/app/src/main/res/drawable-$2/com_garena_shopee_logo_shopee_launcher.png $3$4/intermediate.png $3$4/com_garena_shopee_logo_shopee_launcher.png
@riggaroo
riggaroo / AndroidManifest.xml
Created April 13, 2016 17:31
Custom Android Espresso Test Runner - Unlocking a Device, Granting Permission to turn animations off, turning the Screen on.
<?xml version="1.0" encoding="utf-8"?>
<!-- Put this file in the "debug" folder so it only gets merged into debug builds -->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="org.bookdash.android">
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<!-- Disable animations on debug builds so that the animations do not interfere with Espresso
@xrigau
xrigau / AndroidManifest.xml
Last active October 22, 2022 02:36
Disable animations for Espresso tests - run with `gradle cATDD`
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.novoda.espresso">
<!-- For espresso testing purposes, this is removed in live builds, but not in dev builds -->
<uses-permission android:name="android.permission.SET_ANIMATION_SCALE" />
<!-- ... -->
@passsy
passsy / material text sizes.md
Last active May 25, 2023 04:24
Material font sizes