Skip to content

Instantly share code, notes, and snippets.

View AmrSaleh's full-sized avatar

Amr Saleh AmrSaleh

View GitHub Profile
@astariul
astariul / README.md
Last active May 25, 2025 00:06
Solution for Facebook coding problem "Missing Mail"

Missing Mail

You are the manager of a mail room which is frequently subject to theft. A period of N days is about to occur, such that on the i-th day, the following sequence of events will occur in order:

  • A package with a value of Vi dollars will get delivered to the mail room (unless Vi = 0, in which case no package will get delivered).
  • You can choose to pay C dollars to enter the mail room and collect all of the packages there (removing them from the room), and then leave the room.
  • With probability S, all packages currently in the mail room will get stolen (and therefore removed from the room).

Note that you're aware of the delivery schedule V1..N, but can only observe the state of the mail room when you choose to enter it, meaning that you won't immediately be aware of whether or not packages were stolen at the end of any given day.

@AmrSaleh
AmrSaleh / FabricToFirebaseGuide.md
Created December 3, 2019 12:46
Explained steps to migrate your Android/IOS Project to use Firebase Analytics and App distribution instead of Fabric Crashlytics and Beta distribution.

Fabric to Firebase

FabricFirebase

As we all know that Fabric is being migrated to Firebase and all Fabric features (Crashlytics, Beta, etc.) will have their equivalents in Firebase (Analytics, Distribution, etc.)

As a result we will need to migrate our current Fabric projects to Firebase in order to keep our analytic data and continue using other features like Beta distribution.

In this article I will try to simplify all the steps needed to migrate you project to Firebase, keep your analytics and configure automated releases using Fastlane and CircleCI.

Migration steps from Fabric to Firebase.

@AmrSaleh
AmrSaleh / AndroidToKotlinTips.md
Last active June 10, 2019 10:57
We highlight some of the tips and tricks to take into consideration while migration your Android Java project to Kotlin.

Android Java to Kotlin (Things to take into consideration)

Kotlin-for-Android-development

1. View Binding

The old school way

Usually while writing view binding code for android you need to declare your view components and then bind them to their respective views using findViewById which is a lot of hassle and can even reduce your performance if done in a wrong way. Typically is tedious and looks something like this.

class MainActivity extends Activity {
TextView title;
@comigor
comigor / README.md
Created November 14, 2018 15:33
Generate a Pomfile to an Android library (AAR)

Maven Publish Pomfile Generator

To be used in conjunction of maven-publish to correctly generate an AAR Pomfile.

Why?

For some reason, I can't get maven-publish to generate a Pomfile when I'm exporting an Android library (AAR). This plugin generates the Pomfile by looking at library's classpath and exclusions.

Usage

@stuart11n
stuart11n / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote