Skip to content

Instantly share code, notes, and snippets.

View MahmoudMabrok's full-sized avatar
🏠
Working from home

Mahmoud Mabrok Fouad MahmoudMabrok

🏠
Working from home
View GitHub Profile
@MahmoudMabrok
MahmoudMabrok / task.gradle.kts
Created December 19, 2023 14:41
Prepare files for code review
tasks.register("addSpaceToEndOfLines") {
description = "Add space to the end of each line in .kt files and commit changes to Git"
doLast {
println("Starting magic")
project.exec {
commandLine("git", "checkout", "-b" , "refactor/submitCode")
}
fun main(){
val company = Company("DevMaster")
val department = Department("Programming")
val employeeAhmed = Employee("Mahmoud", 26)
val employeeMahmoud = Employee("Ammar", 1)
val employeeMariam = Employee("Mariam", 23)
department.addEmployee(employeeAhmed)
department.addEmployee(employeeMahmoud)
@MahmoudMabrok
MahmoudMabrok / resize.kt
Last active May 12, 2021 12:24
story reply
private fun makeViewFullWidth(view: View) {
val point = Point()
// point will be populated with screen width and height
activity?.windowManager?.defaultDisplay?.getSize(point)
val param = view.layoutParams
param.width = point.x
param.height = point.y
view.layoutParams = param
}
@MahmoudMabrok
MahmoudMabrok / lib.md
Created February 27, 2021 15:52
espresso with kotlin


  // Unit testing with junit
  testImplementation 'junit:junit:4.13.2'

  // Core library
  androidTestImplementation 'androidx.test:core:1.3.0'

 // AndroidJUnitRunner and JUnit Rules,Runner
@MahmoudMabrok
MahmoudMabrok / convert text into image.sh
Created August 13, 2020 14:17
prepare data to train OCR
for i in `seq 1001`;
do
text2image --text $i.gt.txt --outputbase /home/owner/Downloads/output/im$i --xsize 680 --ysize 200 --fonts_dir /usr/share/fonts/truetype/Amiri/ --font 'Amiri' --margin 0 --ptsize 30 --degrade_image --char_spacing 1;
done
package com.inova.algym.utils
import android.Manifest
import android.content.Context
import android.content.pm.PackageManager
import android.location.Location
import android.location.LocationListener
import android.location.LocationManager
import android.os.Bundle
import androidx.core.content.ContextCompat
void main() {
RegExp exp = new RegExp(r"[a-zA-Z]+");
String str = "Parse my string";
print('${getByToken(str, '[a-zA-Z]+')}');
}
List<String> getByToken(var str , var token){
RegExp exp = new RegExp("${token}");
print('${exp.pattern}');
Iterable<RegExpMatch> matches = exp.allMatches(str);
package com.example.firstapp;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor "com.jakewharton:butterknife-compiler:10.1.0"
implementation "com.balsikandar.android:crashreporter:1.0.9"
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
import java.util.Scanner;
public class Try {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int n=in.nextInt();
Scanner S=new Scanner(System.in);
String []s=new String[30];
for (int i = 0; i < n; i++) {
s[i]=S.nextLine();
}