Skip to content

Instantly share code, notes, and snippets.

View Fatimamostafa's full-sized avatar
🎯

Fatima Mostafa Fatimamostafa

🎯
View GitHub Profile
@Fatimamostafa
Fatimamostafa / introrx.md
Created January 1, 2019 17:55 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
try {
PackageInfo info = getPackageManager().getPackageInfo(
"com.audacityit.jigglemed", PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (Exception e) {
@Fatimamostafa
Fatimamostafa / Utils.java
Last active June 1, 2018 10:23
ISO8601 date format parsing
//Date converter
public static String dateConverter(String dateFromApi) {
TimeZone tz = Calendar.getInstance().getTimeZone();
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
inputFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
SimpleDateFormat outputFormat = new SimpleDateFormat("dd MMM h:mm a");
Date date = null;
try {
@Fatimamostafa
Fatimamostafa / tranparent_gradient.xml
Created January 23, 2018 12:06
handy transparent gradient
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:startColor="#494949"
android:endColor="#1cffffff"
android:type="linear" />
</shape>
@Fatimamostafa
Fatimamostafa / dashed_line.xml
Created January 22, 2018 10:41
Dashed line view
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:bottom="0dp"
android:right="0dp"
android:top="0dp">
<shape android:shape="line">
<stroke
android:width="1dp"
@Fatimamostafa
Fatimamostafa / Memory collection.java
Last active October 16, 2017 17:26
Store data in memory with collection. Compare memory allocation performance.
private Map<Integer, Person> map;
private SparseArray<Person> sparseArray;
//Memory allocation 17.45
public void onMapBtnClick() {
map = new Hashmap();
for(int i = 0; i< 10000; i++) {
Person p = new Person(i, "Person " + i);
map.put(i, p);