Skip to content

Instantly share code, notes, and snippets.

View andhikayuana's full-sized avatar
🌏
bertapa

Andhika Yuana andhikayuana

🌏
bertapa
View GitHub Profile
@andhikayuana
andhikayuana / gist:4b5e1c4c94760d3ff44e478e527c18be
Created July 24, 2023 08:44 — forked from patrickhammond/gist:0b13ec35160af758d98c
Sample for how to use the Google Play Services dynamic security provider to keep the SSL library that the app will use to up date.
package com.mycompany.myapp.app;
import android.app.Application;
import android.content.Intent;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.security.ProviderInstaller;
import com.google.android.gms.security.ProviderInstaller.ProviderInstallListener;
public class MainApplication extends Application {
@andhikayuana
andhikayuana / MainActivity.java
Created July 12, 2023 06:33 — forked from rafaeltoledo/MainActivity.java
Intercept Autolinks in TextView
package net.rafaeltoledo.autolinks;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.text.SpannableString;
import android.text.style.URLSpan;
import android.util.Log;
import android.view.View;
@andhikayuana
andhikayuana / process.kt
Created July 10, 2023 03:54 — forked from seanf/process.kt
Execute process from Kotlin
import java.lang.ProcessBuilder.Redirect
import java.util.concurrent.TimeUnit
fun String.runCommand(workingDir: File? = null) {
val process = ProcessBuilder(*split(" ").toTypedArray())
.directory(workingDir)
.redirectOutput(Redirect.INHERIT)
.redirectError(Redirect.INHERIT)
.start()
if (!process.waitFor(10, TimeUnit.SECONDS)) {
@andhikayuana
andhikayuana / Convert .mov or .MP4 to .gif.md
Created June 27, 2022 03:05 — forked from SheldonWangRJT/Convert .mov or .MP4 to .gif.md
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

@andhikayuana
andhikayuana / RealPathUtil.java
Created January 8, 2023 07:59 — forked from tatocaster/RealPathUtil.java
Real Path Utility class for Android, works for all API
public class RealPathUtil {
public static String getRealPath(Context context, Uri fileUri) {
String realPath;
// SDK < API11
if (Build.VERSION.SDK_INT < 11) {
realPath = RealPathUtil.getRealPathFromURI_BelowAPI11(context, fileUri);
}
// SDK >= 11 && SDK < 19
else if (Build.VERSION.SDK_INT < 19) {
@andhikayuana
andhikayuana / GIF-Screencast-OSX.md
Created June 27, 2022 03:05 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@andhikayuana
andhikayuana / TextViewDrawableSize.java
Created April 27, 2022 05:01 — forked from hrules6872/TextViewDrawableSize.java
TextViewDrawableSize - CompoundDrawable size
public class TextViewDrawableSize extends TextView {
private static final int DEFAULT_COMPOUND_DRAWABLE_SIZE = -1;
private int compoundDrawableWidth;
private int compoundDrawableHeight;
public TextViewDrawableSize(Context context) {
this(context, null);
}
public TextViewDrawableSize(Context context, AttributeSet attrs) {
import android.content.Context
import android.content.res.Resources
import android.graphics.drawable.Drawable
import android.support.annotation.AnyRes
import android.support.v4.app.Fragment
import android.support.v4.content.res.ResourcesCompat.*
import android.view.View
val Context.animations
get() = ResourceMapper { resources.getAnimation(it) }
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@andhikayuana
andhikayuana / README.MD
Created January 26, 2022 08:59 — forked from gabrielemariotti/README.MD
How to use the ShapeableImageView.

The Material Components Library introduced with the 1.2.0-alpha03 the new ShapeableImageView.

In your layout you can use:

 <com.google.android.material.imageview.ShapeableImageView
      android:id="@+id/image_view"
      app:srcCompat="@drawable/..." />

Then in your code apply the ShapeAppearanceModel to define your custom corners: