Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

Mojtaba shafaei Mojtaba-Shafaei

💭
I may be slow to respond.
Block or report user

Report or block Mojtaba-Shafaei

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View PersianCollator.java
import java.text.Collator;
import java.text.ParseException;
import java.text.RuleBasedCollator;
import java.util.Locale;
public class PersianCollator{
/**
* This string is persian collation rules which is in fact a modification to existing arabic collation rules. Features of these rules are: 1. vav
* (u0648) is put before heh (u0647) 2. persian yeh (u06cc) is sorted before arabic yeh (0649 and 064a) 3. persian kaf (u06a9) is sorted before arabic
@Mojtaba-Shafaei
Mojtaba-Shafaei / RxBus.java
Last active Oct 21, 2018
RxBus with RxJava2
View RxBus.java
public final class RxBus{
private static SparseArray<PublishSubject<Object>> sSubjectMap = new SparseArray<>();
private static Map<Object, CompositeDisposable> sSubscriptionsMap = new HashMap<>();
private RxBus(){
}
@Retention(SOURCE)
View install JDK on ubuntu
Download JDK .tar.gz file
Extract it to “/usr/local/java” it means finally it appears like this “/usr/local/java/jdk1.8.0_144”
Edit the system PATH file “/etc/profile” and add the following system variables to your system path.
JAVA_HOME=/usr/local/java/jdk1.7.0_45
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH”
View gist:4f2da2ebee85458254d9944aa5ab9efa
^0{1}((((910)|(911)|(912)|(913)|(914)|(915)|(916)|(917)|(918)|(919)|(990)|(991)|(901)|(902)|(903)|(905)|(930)|(933)|(934)|(935)|(936)|(937)|(938)|(939)|(932)|(920)|(921)|(922)){1}[0-9]{7})|((99999|99998|99911|99912|99913|99914){1}[0-9]{5})|(9981[0-9]{6}))$
```
@Mojtaba-Shafaei
Mojtaba-Shafaei / gist:a8d70824c34adc5dd21c7ad1d47316a0
Created Jul 31, 2018
disable alt + shift shortcut in ubuntu 18(Gnome)
View gist:a8d70824c34adc5dd21c7ad1d47316a0
dconf write /org/gnome/desktop/input-sources/xkb-options "['grp_led:scroll']"
View google logo colors
brandBlue = 0xFF4285F4
brandRed = 0xFFEA4335
brandYellow = 0xFFFBBC04
brandGreen = 0xFF34A853
View gist:7270eb3ef08b8ddde3bc3ea42c7f44c4

force google chrome to resolve dns through socks proxy:

1- run shadowsocks over localhost:1080
2- run chrome with `google-chrome --proxy-server="socks5://localhost:1080"`
3- turn off chrome-setting : `Use a prediction service to load pages more quickly`
View RecyclerView.java
package com.e_estekhdam.android.app.component;
import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
public class RecyclerView extends android.support.v7.widget.RecyclerView {
@Mojtaba-Shafaei
Mojtaba-Shafaei / FullScreen.java
Last active Dec 12, 2017
Adding Immersive Mode to Your Android App
View FullScreen.java
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
);
You can’t perform that action at this time.