Skip to content

Instantly share code, notes, and snippets.

Avatar
Work from home

Muh Isfhani Ghiath isfaaghyth

Work from home
View GitHub Profile
@isfaaghyth
isfaaghyth / isfa.md
Last active Jul 20, 2020
👾 Android Space
View isfa.md

anything about android stuff!

get current activity

adb shell dumpsys window windows | grep -E 'mCurrentFocus'

start activity

adb shell am start -a android.intent.action.MAIN -n com.isfaaghyth.sample/.MainActivity

start activity with applink

adb shell am start -a android.intent.action.VIEW -d 'isfaaghyth://home'

View CacheManager.kt
internal class CacheManager(context: Context?) {
val preferences: SharedPreferences? by lazy(LazyThreadSafetyMode.NONE) {
sharedPreferences(context)
}
inline fun <reified T> entry(key: String, obj: T) {
val objString = Gson().toJson(obj, T::class.java)
preferences?.edit()?.putString(key, objString)
}
View PopularMovieAdapter.kt
package app.tokopedia.movie.ui
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import app.tokopedia.movie.R
import kotlinx.android.synthetic.main.item_movie.view.*
import tokopedia.app.abstraction.util.ext.load
import tokopedia.app.data.entity.Movie
View file.md

Raw Query Factory:

interface GraphQuery {
    @RawQuery(R.raw.product_search)
    fun productSearch(): Extractor<String>
}

Thread:

View EndlessRecyclerViewScrollListener.kt
package com.apps.search.utils
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.StaggeredGridLayoutManager
abstract class EndlessRecyclerViewScrollListener : RecyclerView.OnScrollListener {
// The minimum amount of items to have below your current scroll position
// before loading more.
View ffmeg video square crop
fun ffmegCommand(cropSize: Int?, sourceFile: String, resultFile: String): Array<String> {
return arrayOf(
"-i",
sourceFile,
"-filter:v",
"crop=$cropSize:$cropSize",
"-codec:v",
"libx264",
"-profile:v",
"high",
@isfaaghyth
isfaaghyth / mysql.sql
Created Dec 20, 2018
InnoDB: Unable to lock ./ibdata1, error: 11
View mysql.sql
# cd /var/lib/mysql
# mkdir bak
# mv ibdata1 bak/.
# mv ib_logfile* bak/.
# cp -a bak/ibdata1 ibdata1
# cp -a bak/ib_logfile* .
# service mysql restart
View HaversineFormula.java
public class HaversineFormula {
static double lat1, lat2, deg;
public HaversineFormula() {}
public static double calculate(double initialLat, double initialLong, double finalLat, double finalLong){
int R = 6371; // km
double dLat = toRadians(finalLat - initialLat);
View CacheManager.java
public class CacheManager {
private static final String TAG = "CacheManager";
private static SharedPreferences getPref() {
return PreferenceManager.getDefaultSharedPreferences(RangerApplication.getContext());
}
public static void save(String key, String value) {
Log.d(TAG, "saveCache: " + value);
View mojave
Pre Mojave (from Sierra or High Sierra)
======================================================
1. boot into recovery mode
2. take your logical volume ID
$ diskutil cs list
3. change CoreStorage logical volume into normal disk partition
# diskutil cs revert <<LOGICAL_VOLUME_ID>>
4. restart! and welcome to mojave installer.
Post Mojave
You can’t perform that action at this time.