public class ItemOffsetDecoration extends RecyclerView.ItemDecoration {
private int mItemOffset;
public ItemOffsetDecoration(int itemOffset) {
mItemOffset = itemOffset;
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // show Base64 image in iOS | |
| import UIKit | |
| extension UIImageView { | |
| func setImage( | |
| base64: String?, | |
| placeholder: UIImage? = nil | |
| ){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); |
NewerOlder