Skip to content

Instantly share code, notes, and snippets.

["curious", "learner", "forward", "patient"];

Mohammad Azimi MohammadAzimi

["curious", "learner", "forward", "patient"];
View GitHub Profile
View createUrl.js
// curring fuction;
// mix of closure;
function createUrl(baseUrl, protocol = 'https') {
// we can have some other process here
return function (path) {
return `${protocol}://${baseUrl}/${path}`;
const createClubUrl = createUrl('');
MohammadAzimi / network_security_config.xml
Created May 9, 2021
android network_security_config file for react-native. should be added to android/app/src/main/res/xml
View network_security_config.xml
<!-- react native -->
<?xml version="1.0" encoding="utf-8"?>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true"></domain>
<domain includeSubdomains="false">localhost</domain>
<domain includeSubdomains="false"></domain>
<domain includeSubdomains="false"></domain>
<base-config cleartextTrafficPermitted="true">
MohammadAzimi / .htaccess
Last active Jan 6, 2021
server tricks in react js
View .htaccess
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]
MohammadAzimi / DeviceDetector.js
Last active Jul 3, 2021
Helper methods and functions - ReactNative, ReactJS, ReactNativeWeb and Monorepo design pattern for single source of code
View DeviceDetector.js
import React from 'react';
import {Image, Platform, StyleSheet, Text, View} from 'react-native';
import {useIsMount} from '/Helper';
const ReactDeviceDetect = Platform.OS === 'web' ? require('react-device-detect') : {}
const {isIOS, isMobile, isMobileOnly, isTablet} = ReactDeviceDetect;
const PORTRAIT = 'portrait-primary';
const initialOrientationValue = Platform.OS === 'web' ? window.matchMedia("(orientation: portrait)").matches : true;