Skip to content

Instantly share code, notes, and snippets.

View AmandaRiu's full-sized avatar
🏠
Working from home

Amanda Riu AmandaRiu

🏠
Working from home
View GitHub Profile
@AmandaRiu
AmandaRiu / fav_android_tools
Created December 20, 2016 15:34
List of all the Android gems I've found to date
# ImageView with support for gesture and double-click zooming and panning. Also supports rotations.
https://github.com/chrisbanes/PhotoView
@AmandaRiu
AmandaRiu / android_utility_code_snippets
Created October 4, 2017 20:49
Android Utility Code Snippets
/**
* Toggles the status of a component to enabled or disabled. Specifically used for enabling
* and disabling broadcast receivers. So in the case of a broadcast receiver listening for
* connectivity change...you may not want this always running, rather to toggle it on or off
* as needed.
*
* @param context Application-specific context
* @param componentClass The class to enable or disable
* @param enable Action to be taken on the class
*/

Global commands

Command Description
brew update Update brew and cask
brew list List installed packages
brew outdated List packages that need updating

Package Commands

Command Description
@AmandaRiu
AmandaRiu / BottomNav_disableShift.kt
Created April 21, 2018 01:26
Disable android 'BottomNavigationView' shift mode
// Extension function
@SuppressLint("RestrictedApi")
fun BottomNavigationView.disableShiftMode() {
val menuView = getChildAt(0) as BottomNavigationMenuView
try {
val shiftingMode = menuView::class.java.getDeclaredField("mShiftingMode")
shiftingMode.isAccessible = true
shiftingMode.setBoolean(menuView, false)
shiftingMode.isAccessible = false
for (i in 0 until menuView.childCount) {
@AmandaRiu
AmandaRiu / kotlin_tricks.md
Last active May 5, 2018 00:41
Random kotlin tricks

Change generated getter/setter methods

Kotlin does something strange with boolean types. If you have a boolean called isCanceled, the setter will be setCanceled(boolean) and the getter will be isCanceled(). Override this naming convention:

var isCanceled = false
  @JvmName("setIsCanceled")
  get

Assign method to variable and pass as argument

@AmandaRiu
AmandaRiu / pr.md
Created July 23, 2018 20:45 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

<?xml version="1.0" encoding="utf-8"?>
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true">
<TextView
android:id="@+id/switchSetting_title"
@AmandaRiu
AmandaRiu / logcatapp.sh
Created October 11, 2018 16:35 — forked from kevinxucs/logcatapp.sh
Filter logcat by app package name
#!/bin/bash
usage() {
echo "Usage: $(basename $0) [package] ..."
}
app_package=$1
shift
if [ -z $app_package ]; then
@AmandaRiu
AmandaRiu / ios_e2e_test_error.md
Created April 6, 2021 04:20
iOS e2e test error

Command

/Users/amandariu/development/a8c/gutenberg-dev/packages/react-native-editor/ios/vendor/bundle/ruby/2.6.0/bin/pod install --repo-update

Report

  • What did you do?