Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Mahmoud Mabrok Fouad MahmoudMabrok

🏠
Working from home
View GitHub Profile
View test
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();
}
View utils
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'
View server code
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;
View tokens
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);
View Helper.kt
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
View convert text into image.sh
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
@MahmoudMabrok
MahmoudMabrok / lib.md
Created Feb 27, 2021
espresso with kotlin
View lib.md


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

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

  // AndroidJUnitRunner and JUnit Rules,Runner
View resize.kt
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
}