Skip to content

Instantly share code, notes, and snippets.

View zakayothuku's full-sized avatar
👨‍💻
Opportunities don't respect sleep

Zakayo Thuku zakayothuku

👨‍💻
Opportunities don't respect sleep
View GitHub Profile
@zakayothuku
zakayothuku / delete_git_submodule.md
Created September 19, 2022 15:27 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
package jetpack.navigation.workaround
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.LiveData
import androidx.lifecycle.Observer
import androidx.navigation.NavController
import androidx.navigation.ui.setupActionBarWithNavController
import com.google.android.material.bottomnavigation.BottomNavigationView
import java.lang.ref.WeakReference
@zakayothuku
zakayothuku / README.md
Created August 17, 2021 20:21 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

Using Tinder's Finite State Machine Library to wrap Android's MediaPlayer

When developing software, it's sometimes very easy to get overwhelmed by complexity due to the number of interacting pieces.

This is a problem that's prevalent in all software development from Server-Side development, Front-End development and all the way to Android development.

In a bid to tame complexity software engineers building complex software have looked up to tools that help reduce this burden. One such tool is design using Finite State Machines.

In this tutorial we'll be using Tinder's State Machine to model an Entity and handle complexity of dealing with the many possible states it can be in a manner that makes it almost effortless.

@zakayothuku
zakayothuku / circleci
Created June 22, 2020 21:25 — forked from ajaysaini-sgvu/circleci
config.yml
version: 2
references:
## Cache
cache_key: &cache_key
key: cache-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "build.gradle" }}-{{ checksum "mobile/build.gradle" }}
restore_cache: &restore_cache
restore_cache:
@zakayothuku
zakayothuku / git-tag-delete-local-and-remote.sh
Created June 19, 2020 09:14 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
# Assume we are in your home directory
cd ~/
# Clone the repo from GitLab using the `--mirror` option
$ git clone --mirror git@your-gitlab-site.com:mario/my-repo.git
# Change into newly created repo directory
$ cd ~/my-repo.git
# Push to GitHub using the `--mirror` option. The `--no-verify` option skips any hooks.
@zakayothuku
zakayothuku / ReceiverRegistrar.java
Created June 11, 2020 18:15 — forked from curioustechizen/ReceiverRegistrar.java
Tiny utility class that helps avoid book-keeping code when dealing with registering and unregistering BroadcastReceivers. Hopefully, this will help you get rid of "Activity has leaked IntentReceiver that was originally registered here" messages without resorting to using boolean flags to keep track of your BroadcastReceivers.
package com.github.curioustechizen.safereg;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v4.util.ArrayMap;
/**
* Helper class to keep track of what {@code BroadcastReceiver}s have been
package com.geekorum.geekdroid.navigation
import android.content.Context
import android.os.Bundle
import android.util.AttributeSet
import androidx.core.content.res.use
import androidx.core.os.bundleOf
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
package com.geekorum.geekdroid.navigation
import android.content.Context
import android.os.Bundle
import android.util.AttributeSet
import androidx.core.content.res.use
import androidx.core.os.bundleOf
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager