Skip to content

Instantly share code, notes, and snippets.

💻
Coding ...

Arash Hatami hatamiarash7

💻
Coding ...
Block or report user

Report or block hatamiarash7

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
@hatamiarash7
hatamiarash7 / index.md
Last active May 22, 2019
PHP group array items by key
View index.md

Groups an array into another array by a given $key

function array_group(array $array, $key)
{
    $result = [];

    foreach ($array as $item) {
        $column = $item[$by_column];
        unset($item[$by_column]);
@hatamiarash7
hatamiarash7 / url_mask.js
Created May 21, 2019 — forked from Bewitchedyegor/url_mask.js
URL mask based on jquery.mask.js
View url_mask.js
$('#banner_link').inputmask("url", {
mask: "https://www.*{1,20}[.*{1,20}]",
greedy: false,
clearMaskOnLostFocus: false,
clearIncomplete: false,
definitions: {
'*': {
validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~\-]",
cardinality: 1,
casing: "lower"
View zabbix 3.2, Ubuntu 16.04.1, php7, nginx, postgres.md

cd ~/Downloads

wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+xenial_all.deb

dpkg -i zabbix-release_3.2-1+xenial_all.deb

apt-get update

should add /etc/apt/sources.list.d/zabbix.list

@hatamiarash7
hatamiarash7 / LEARN-7.md
Last active Jun 8, 2018
Configure Git to use a proxy
View LEARN-7.md
  1. Define proxy in .gitconfig ( You can find it by run this command : git config --list --global --show-origin )

    [http]
        proxy = http://username:password@proxydomain:port
        sslverify = false
    [https]
        proxy = http://username:password@proxydomain:port
        sslverify = false
    
  2. Use environment variable

@hatamiarash7
hatamiarash7 / 1. Install Redis
Created May 31, 2018 — forked from pbolduc/1. Install Redis
Install redis on CentOS 7
View 1. Install Redis
# see How to Install Redis Server on CentOS 7 - http://linoxide.com/storage/install-redis-server-centos-7/
# --- Compiling ---
$ yum install gcc make tcl
$ REDIS_VER=3.2.3
$ wget http://download.redis.io/releases/redis-$REDIS_VER.tar.gz
$ tar xzvf redis-$REDIS_VER.tar.gz
$ cd redis-$REDIS_VER
$ make
$ make test
@hatamiarash7
hatamiarash7 / Upload.java
Created Mar 26, 2018
Android File Upload
View Upload.java
static void uploadFile(Context context, final String selectedFilePath) {
int serverResponseCode = 0;
HttpURLConnection connection;
DataOutputStream dataOutputStream;
String lineEnd = "\r\n";
String twoHyphens = "--";
String boundary = "*****";
int bytesRead, bytesAvailable, bufferSize;
byte[] buffer;
@hatamiarash7
hatamiarash7 / Validation.java
Created Mar 26, 2018
Android Validation rules
View Validation.java
public static boolean isValidEmail(String target) {
boolean check1 = Patterns.EMAIL_ADDRESS.matcher(target).matches();
Pattern pattern;
Matcher matcher;
String EMAIL_PATTERN = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
pattern = Pattern.compile(EMAIL_PATTERN);
matcher = pattern.matcher(target);
boolean check2 = matcher.matches();
return target.isEmpty() || check1 && check2;
}
@hatamiarash7
hatamiarash7 / UID.java
Created Mar 26, 2018
Android Generate Unique ID
View UID.java
@SuppressWarnings("deprecation")
@SuppressLint("HardwareIds")
public static HashMap<String, String> GenerateDeviceInformation(Context context) {
HashMap<String, String> result = new HashMap<>();
String pseudoId = "35" +
Build.BOARD.length() % 10 +
Build.BRAND.length() % 10 +
Build.CPU_ABI.length() % 10 +
Build.DEVICE.length() % 10 +
Build.DISPLAY.length() % 10 +
@hatamiarash7
hatamiarash7 / hideStatusbar.java
Created Mar 19, 2018
Android - Hide statusbar
View hideStatusbar.java
public static void hideStatusbar(Activity context) {
if (Build.VERSION.SDK_INT < 16) {
context.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
View decorView = context.getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
}
}
@hatamiarash7
hatamiarash7 / LEARN-6.md
Created Feb 23, 2018
Android Toolbar Logo Size
View LEARN-6.md
  • MDPI : 75x32
  • HDPI : 112x48
  • XHDPI : 149x64
  • XXHDPI : 225x96
  • XXXHDPI : 300x128
You can’t perform that action at this time.