Skip to content

Instantly share code, notes, and snippets.

keep calm and work hard

Abdullah Alhazmy alhazmy13

keep calm and work hard
View GitHub Profile
alhazmy13 / gist:cfd36ecfcd8262bb5e53d68af1b14133
Last active Jun 28, 2020
📊 Weekly development breakdown
We couldn’t find that file to show.
alhazmy13 /
Last active Nov 21, 2019
RxJava and Retrofit - Example with Github API
import retrofit.RestAdapter;
import retrofit.http.GET;
import retrofit.http.Path;
import rx.Observable;
import rx.Subscriber;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.functions.Func2;
alhazmy13 / index.js
Created Feb 13, 2019 — forked from MoOx/index.js
Export/import github labels
View index.js
// go on you labels pages
// eg
// paste this script in your console
// copy the output and now you can import it using !
var labels = [];
.forEach(function(element) {
name: element.textContent.trim(),
View OpenPDF file - Android
1. create assets folder in src under your app name.
2. In this assets folder keep your pdf files e.g. file.pdf.
3 now come your activity i.e
4. setListener on any UI component what you want i.e (Button,ImageView,ImageButton);
5. In this listener call one user defined method i.e. openPDFFiles("file.pdf");
the openPDFFiles() method have below code:—-
private void openPDFFiles(String fileName) //fileName is the pdf file name which is keep in assets folder. ex file.pdf
alhazmy13 /
Last active Mar 1, 2017
This class is used to change your application locale and save this change for the next time.
* Created by Alhazmy13 on 11/6/16.
public class LocalUtility {
private static final String SAVED_LANG = "LOCALE_SAVED_LANG";
public static void onCreate(Context context) {
String lang = getSavedData(context, Locale.getDefault().getLanguage());
setLocale(context, lang);
alhazmy13 /
Last active Nov 18, 2016
Dagger example with App & Net Module
public class App extends Application {
private static final String TAG = "App";
private NetComponent mNetComponent;
public void onCreate() {
mNetComponent = DaggerNetComponent.builder()
.appModule(new AppModule(this)) // This also corresponds to the name of your module: %component_name%Module
.netModule(new NetModule(UrlHelper.getBaseUrl()))
// Create a RealmConfiguration that saves the Realm file in the app's "files" directory.
RealmConfiguration realmConfig = new RealmConfiguration.Builder(context).build();
// Get a Realm instance for this thread
Realm realm = Realm.getDefaultInstance();
alhazmy13 /
Last active Jul 24, 2016
Run PHP script in background
  • Create a daemon configuration script under /etc/init ( NOT /etc/init.d ):-

nano /etc/init/mybot.conf

code sample:

description "MyBot Daemon"
author "alhazmy13"
start on startup
stop on shutdown
* Created by Alhazmy13 on 7/11/16.
public class Test {
int arg1,arg2,arg3;
public Test() {
// A no arguments constructor that sends default values to the largest
alhazmy13 /
Last active Jun 6, 2016
Improve quality and syntax of your Android code

Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. It automates the process of checking Java code to spare humans of this boring (but important) task.

Add below code to your project and then launch the task checkstyle from the gradle panel alt text

You can’t perform that action at this time.