Skip to content

Instantly share code, notes, and snippets.

View alhazmy13's full-sized avatar
👽
keep calm and work hard

Abdullah Alhazmy alhazmy13

👽
keep calm and work hard
View GitHub Profile
@alhazmy13
alhazmy13 / STATS.md
Last active September 20, 2020 09:53

Alhazmy github stats

@alhazmy13
alhazmy13 / 📊 Weekly development breakdown
Last active October 29, 2020 13:41
📊 Weekly development breakdown
HTML 7 mins █████████▏░░░░░░░░░░░ 43.8%
JSON 4 mins █████▍░░░░░░░░░░░░░░░ 26.1%
Vue.js 3 mins ███▊░░░░░░░░░░░░░░░░░ 18.0%
CSS 1 min ██▏░░░░░░░░░░░░░░░░░░ 10.5%
Other 0 secs ▎░░░░░░░░░░░░░░░░░░░░ 1.6%
@alhazmy13
alhazmy13 / index.js
Created February 13, 2019 08:41 — forked from MoOx/index.js
Export/import github labels
// go on you labels pages
// eg https://github.com/cssnext/cssnext/labels
// paste this script in your console
// copy the output and now you can import it using https://github.com/popomore/github-labels !
var labels = [];
[].slice.call(document.querySelectorAll(".label-link"))
.forEach(function(element) {
labels.push({
name: element.textContent.trim(),
@alhazmy13
alhazmy13 / LocalUtility.java
Last active March 1, 2017 05:18
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
alhazmy13 / App.java
Last active November 18, 2016 00:38
Dagger example with App & Net Module
public class App extends Application {
private static final String TAG = "App";
private NetComponent mNetComponent;
@Override
public void onCreate() {
super.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()))
@alhazmy13
alhazmy13 / temp.md
Last active July 24, 2016 06:30
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
// Create a RealmConfiguration that saves the Realm file in the app's "files" directory.
RealmConfiguration realmConfig = new RealmConfiguration.Builder(context).build();
Realm.setDefaultConfiguration(realmConfig);
// Get a Realm instance for this thread
Realm realm = Realm.getDefaultInstance();
/**
* 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
this(1,2,3);
@alhazmy13
alhazmy13 / Checkstyle.md
Last active June 6, 2016 12:30
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

@alhazmy13
alhazmy13 / Example.java
Last active November 21, 2019 19:35
RxJava and Retrofit - Example with Github API
package com.company;
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;