Skip to content

Instantly share code, notes, and snippets.

View moehandi's full-sized avatar
:octocat:

M. Andi Saputra moehandi

:octocat:
  • Jakarta, Indonesia
View GitHub Profile
@moehandi
moehandi / activity_main.xml
Created March 19, 2016 17:10
Set Android NavigationView below Toolbar in default Android Studio Project Template
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
@moehandi
moehandi / Readme.md
Created June 8, 2016 10:27 — forked from gabrielemariotti/Readme.md
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

@moehandi
moehandi / OkHttpProgressGlideModule.java
Created June 20, 2016 05:58 — forked from TWiStErRob/OkHttpProgressGlideModule.java
Full POC for showing progress of loading in Glide v3 via OkHttp v2
// TODO add <meta-data android:value="GlideModule" android:name="....OkHttpProgressGlideModule" />
// TODO add <meta-data android:value="GlideModule" tools:node="remove" android:name="com.bumptech.glide.integration.okhttp.OkHttpGlideModule" />
// or not use 'okhttp@aar' in Gradle depdendencies
public class OkHttpProgressGlideModule implements GlideModule {
@Override public void applyOptions(Context context, GlideBuilder builder) { }
@Override public void registerComponents(Context context, Glide glide) {
OkHttpClient client = new OkHttpClient();
client.networkInterceptors().add(createInterceptor(new DispatchingProgressListener()));
glide.register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client));
}
@moehandi
moehandi / include_list_viewpager.xml
Created July 21, 2016 06:43 — forked from iPaulPro/include_list_viewpager.xml
CollapsingToolbarLayout with TabLayout
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (C) 2015 The Android Open Source Project
~
~ 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
@moehandi
moehandi / inheritance_aka_composition.go
Last active November 25, 2016 03:33
Inheritance in golang with composition inside struct type
package main
import "fmt"
type Human struct {
name string
age int
address string
}
@moehandi
moehandi / multiple_ssh_setting.md
Created December 2, 2016 16:20 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@moehandi
moehandi / client.go
Created December 13, 2016 02:39 — forked from spikebike/client.go
TLS server and client
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"log"
)
@moehandi
moehandi / golang-tls.md
Created December 13, 2016 02:40 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
    
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key
------------------------------------------------------------------------
| NAME | Density | Pixels | 1/2 Square | 16:9 Image | Map Marker |
------------------------------------------------------------------------
| ldpi | 0.5 | 180 x 320 | | | |
| mdpi | 1 | 360 x 640 | 180x180 | 360 x 202 | 32 |
| hdpi | 1.5 | 540 x 960 | 270x270 | 540 x 304 | 48 |
| xhdpi | 2 | 720 x 1280 | 360x360 | 720 x 405 | 64 |
| xxhdpi | 3 | 1080 x 1920 | 540x540 | 1080 x 608 | 96 |
|xxxhdpi | 4 | 1440 x 2560 | | 1440 x 810 | |
@moehandi
moehandi / Android jwplayer conflict with play-services-ads
Created January 24, 2017 01:58
Gradle settings for Android jwplayer conflict with play-services-ads
compile ('com.longtailvideo.jwplayer:jwplayer-core:2.6.2+12'){
}
compile ('com.longtailvideo.jwplayer:jwplayer-common:2.6.2+12') {
exclude module: 'appcompat-v7'
}
compile ('com.longtailvideo.jwplayer:jwplayer-ima:2.6.2+12') {
exclude group: 'com.google.android.gms'
exclude module: 'play-services-ads'
}
compile ('com.longtailvideo.jwplayer:jwplayer-chromecast:2.6.2+12'){