Skip to content

Instantly share code, notes, and snippets.

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

Malek Kamel MalekKamel

🏠
Working from home
View GitHub Profile
@MalekKamel
MalekKamel / resize_images.py
Last active March 16, 2025 14:57
Python script that you can run in the terminal to resize images
import os
from PIL import Image
def resize_images_in_folder(folder_path, output_folder, size=(800, 600)):
"""
Resizes all images in the specified folder and saves them to the output folder.
:param folder_path: Path to the folder containing the images.
:param output_folder: Path to the folder where resized images will be saved.
:param size: Tuple (width, height) for the new size. Default is (800, 600).
class Test {
fun isAnagram(str1: CharArray, str2: CharArray): Boolean {
val n1 = str1.size
val n2 = str2.size
if (n1 != n2) return false
str1.sort()
str2.sort()
// show Base64 image in iOS
import UIKit
extension UIImageView {
func setImage(
base64: String?,
placeholder: UIImage? = nil
){
import android.text.TextUtils;
import java.util.Locale;
public class DigitUtil {
public static String toEn(String value){
if (!TextUtils.isDigitsOnly(value))
return value;
return String.format(Locale.US, "%d", Long.valueOf(value));
@MalekKamel
MalekKamel / DottedLine.java
Created September 20, 2017 15:20 — forked from mlagerberg/DottedLine.java
[Vertical dotted line view] #android
package com.pixplicity.gist.ui.views;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathDashPathEffect;
import android.util.AttributeSet;
@MalekKamel
MalekKamel / gist:01eb00a8a16b4f1702f2ea03e1252fd4
Created August 11, 2017 23:56 — forked from yqritc/gist:ccca77dc42f2364777e1
Equal column spacing for Android RecyclerView GridLayoutManager by using custom ItemDecoration

ItemOffsetDecoration

public class ItemOffsetDecoration extends RecyclerView.ItemDecoration {

    private int mItemOffset;

    public ItemOffsetDecoration(int itemOffset) {
        mItemOffset = itemOffset;
    }
@MalekKamel
MalekKamel / gist:a9bf165cf4e2aee47b7cb39dab1b4a75
Created August 11, 2017 23:56 — forked from yqritc/gist:ccca77dc42f2364777e1
Equal column spacing for Android RecyclerView GridLayoutManager by using custom ItemDecoration

ItemOffsetDecoration

public class ItemOffsetDecoration extends RecyclerView.ItemDecoration {

    private int mItemOffset;

    public ItemOffsetDecoration(int itemOffset) {
        mItemOffset = itemOffset;
    }
@MalekKamel
MalekKamel / AndroidManifest.xml
Created June 20, 2017 09:39 — forked from bjoernQ/AndroidManifest.xml
Creating a System Overlay (Always on Top over all Apps) in Android
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.mobilej.overlay"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="14" />
<application android:label="SystemOverlay" >
<activity
@MalekKamel
MalekKamel / ApiService.java
Created June 1, 2017 13:25 — forked from dustin-graham/ApiService.java
Infinite Scrolling Android RecyclerView with RxJava
public static Observable<List<String>> paginatedThings(final Observable<Void> onNextObservable) {
return Observable.create(new Observable.OnSubscribe<List<String>>() {
@Override
public void call(final Subscriber<? super List<String>> subscriber) {
onNextObservable.subscribe(new Observer<Void>() {
int latestPage = -1;
@Override
public void onCompleted() {
subscriber.onCompleted();