Skip to content

Instantly share code, notes, and snippets.

@cutiko
cutiko / LoginActivity.java
Last active April 27, 2025 07:59
How to customize firebase-ui-auth for Android
public class LoginActivity extends AppCompatActivity {
private static final int RC_SIGN_IN = 343;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
@guavabot
guavabot / draw_behind_status_bar.md
Created September 30, 2016 11:43
Draw behind status bar
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    getWindow().getDecorView().setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);

    getWindow().setStatusBarColor(ContextCompat.getColor(this, android.R.color.transparent));
}
@Jonalogy
Jonalogy / handling_multiple_github_accounts.md
Last active September 11, 2026 16:58
Handling Multiple Github Accounts on MacOS

Handling Multiple Github Accounts on MacOS

The only way I've succeeded so far is to employ SSH.

Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config file in a .ssh directory. The config file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh directory by default. You can navigate to it by running cd ~/.ssh within your terminal, open the config file with any editor, and it should look something like this:

Host *
 AddKeysToAgent yes

> UseKeyChain yes

@Kishanjvaghela
Kishanjvaghela / converter.sh
Last active July 8, 2024 21:36
Create Image drawable for all resolutions
if [ $# -eq 0 ]; then
echo "No arguments supplied"
else if [ -f "$1" ]; then
echo " Creating different dimensions (dips) of "$1" ..."
mkdir -p drawable-xxhdpi
mkdir -p drawable-xhdpi
mkdir -p drawable-hdpi
mkdir -p drawable-mdpi
if [ $1 = "ic_launcher.png" ]; then
@hilfritz
hilfritz / gist:5a8ca9e172918bc224f03c3dac9c39f3
Last active November 6, 2024 16:19
Android OnClickListener Prevent multiple clicks
import android.view.View;
/**
* inspired and credits
* @see http://stackoverflow.com/questions/16534369/avoid-button-multiple-rapid-clicks
* A Debounced OnClickListener
* Rejects clicks that are too close together in time.
* This class is safe to use as an OnClickListener for multiple views, and will debounce each one separately.
* This class allows a single click and prevents multiple clicks on
* the same button in rapid succession. Setting unclickable is not enough
@Abdallah-Abdelazim
Abdallah-Abdelazim / linux_desktop_entry_template.md
Last active June 1, 2021 19:01
Template for creating desktop entries (launchers) on Linux

Template for creating desktop entries (launchers) on Linux

Create the following file, with your favourite editor:

  • Across all users: /usr/share/applications/application_name.desktop
  • For current user only: ~/.local/share/applications/application_name.desktop

Add the following content to the file and save:

[Desktop Entry]
Version=1.0
@Abdallah-Abdelazim
Abdallah-Abdelazim / StrPad.java
Created October 21, 2019 13:06
Useful utility methods for controlling the length & adding padding to strings in Java.
/**
* Useful utility methods for controlling the length & adding padding to strings.
*
* @author Abdallah Abdelazim
*/
public final class StrPad {
/**
* Prevent instantiation.
*/
@Abdallah-Abdelazim
Abdallah-Abdelazim / SingleLiveEvent.java
Last active November 19, 2020 11:48
SingleLiveEvent: A lifecycle-aware observable that sends only new updates after subscription, used for events like navigation and Snackbar messages.
/*
* Copyright 2017 Google Inc.
* Copyright 2020 Abdallah Abdelazim.
*
* 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
*
@Abdallah-Abdelazim
Abdallah-Abdelazim / BaseDao.java
Created March 31, 2020 01:44
A BaseDao interface that provides the methods needed for inserting, updating & deleting an entity in a Room Dao interface.
package com.example.app.data.local.dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Update;
import java.util.List;
/**
@Abdallah-Abdelazim
Abdallah-Abdelazim / _fix_alt_shift_layout_switching_kde.md
Last active May 5, 2023 21:49
Fix: Alt+Shift layout switching not working in Arabic keyboard layout on KDE neon/Kubuntu