Skip to content

Instantly share code, notes, and snippets.

View ripzery's full-sized avatar
🎯
Focusing

PS ripzery

🎯
Focusing
  • Thailand
View GitHub Profile
@gwpantazes
gwpantazes / How to Install JDK MacOS Homebrew.md
Last active April 18, 2024 21:43
How to install different JDK versions on MacOS with Homebrew

How To Install Different JDK Versions on MacOS with Homebrew

Keywords: Java, JDK (Java Development Kit), MacOS, Homebrew, Specific Version

This how-to guide covers how to install different versions of the JDK on MacOS with Homebrew.

Table of Contents

@indiesquidge
indiesquidge / promise-dot-all.js
Last active January 20, 2024 15:03
Recreating Promise.all with async/await
/*
Let us re-create `Promise.all`
`Promise.all` method returns a promise that resolves when all of the promises in the iterable argument have resolved,
or rejects with the reason of the first passed promise that rejects.
Read more about `Promise.all` on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all
A basic example would be something like this:
@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 ได้นัดหมายเข้าใช้บริกา
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
@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
@lopspower
lopspower / README.md
Last active January 20, 2024 09:18
Publish AAR to jCenter and Maven Central

Publish AAR to jCenter and Maven Central

Twitter

EDIT: You can find this same updated tutorial here -> Medium

Now I'm going to list how to publish an Android libray to jCenter and then syncronize it with Maven Central:

  1. I use "Android Studio" and I have this simple android lib that I would like to be available on maven: CircularImageView
@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
@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
@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

@seanKenkeremath
seanKenkeremath / Android Lollipop Widget Tinting Guide
Last active November 17, 2023 12:40
How base colors in Lollipop apply to different UI elements
Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21. To use the support version of these attributes, remove the android namespace. For instance, "android:colorControlNormal" becomes "colorControlNormal". These attributes will be propagated to their corresponding attributes within the android namespace for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix.
All Clickable Views:
-----------
* ripple effect (Lollipop only) -- "colorControlHighlight"
Status Bar:
------------
* background (Lollipop only) - "colorPrimaryDark"