Skip to content

Instantly share code, notes, and snippets.

View mohamedagamy's full-sized avatar
:octocat:
coding...

mohamedelagamy mohamedagamy

:octocat:
coding...
View GitHub Profile
@sethlarkin
sethlarkin / the_effective_engineer.md
Created June 27, 2019 23:27 — forked from jaimelr/the_effective_engineer.md
The Effective Engineer notes

Part 1: Adopt the Right Mindsets

Focus on High-Leverage Activities

How should we decide what actually to work on in order to more effectively achieve our goals? Assess the activities' leverage:

Leverage =  (Impact Produce) / (Time Invested)

Another way of thinking about leverage is the commonly-mentioned Pare- to principle, or 80–20 rule—the notion that for many activities, 80% of the im- pact comes from 20% of the work.

@firatkarababa
firatkarababa / DatabaseCopier.java
Last active September 20, 2023 11:12
Copy pre-populated SQLite database
import android.content.Context;
import android.util.Log;
import com.karababapps.ferhengvariants.database.AppDatabase;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import androidx.room.Room;
/** For this example, assume that
* public static final int GENDER_MALE = 1;
* public static final int GENDER_FEMALE = 2;
**/
String[] projection = { PetEntry.COLUMN_PET_BREED,
PetEntry.COLUMN_PET_WEIGHT };
String selection = PetEntry.COLUMN_PET_GENDER + “=?”;
String[] selectionArgs = new String[] { String.valueOf(PetEntry.GENDERFEMALE) };
@wojteklu
wojteklu / clean_code.md
Last active July 17, 2024 11:23
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@ccjeng
ccjeng / CustomInfoWindowAdapter.java
Last active February 27, 2024 12:40
Custom InfoWindow Layout for Google Map in Android
public class CustomInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {
private Activity context;
public CustomInfoWindowAdapter(Activity context){
this.context = context;
}
@Override
package com.example.marcin.splitlayout;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Region;