Skip to content

Instantly share code, notes, and snippets.

@tkhatibi
tkhatibi / generateNationalCode.php
Last active February 6, 2020 14:22 — forked from Alireza2n/nationalCodeGenerator.py
تولید کننده کد ملی در پی‌اچ‌پی
function generateNationalCode()
{
$numbers = [];
$sum = 0;
foreach(array_reverse(range(2, 10)) as $i) {
$j = rand(0, 9);
$numbers[] = $j;
$sum += $j * $i;
}
$m = $sum % 11;
@tkhatibi
tkhatibi / post_install.sh
Created May 18, 2019 11:43 — forked from waleedahmad/post_install.sh
Ubuntu post installation script for installing software of your choice.
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
else
#Update and Upgrade
echo "Updating and Upgrading"
apt-get update && sudo apt-get upgrade -y
/**
* @param {number|string} value
* @returns {string}
*/
const getPrintableElement = (value) => value + " ";
/**
* @param {number} day
* @returns {string}
*/
@tkhatibi
tkhatibi / react-native.md
Last active December 4, 2017 09:45
React Native Tips and Tricks

Usefull Scripts

"scripts": {
  "start": "node node_modules/react-native/local-cli/cli.js start",
  "rc-start": "npm start -- --reset-cache",
  "clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean",
  "clean-start": "npm run clean && npm run rc-start",
  "fresh-install": "rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build/ModuleCache/* && rm -rf node_modules/ && npm cache clean && npm install",
  "fresh-start" : "npm run fresh-install && npm run rc-start",
@tkhatibi
tkhatibi / ecma6-for-php-developers.md
Created November 18, 2016 13:32
OOP in ecmascript 6 for php developers
// Within class A
self::foo();
static::foo();
// Without class A
A::foo()
//
// Within class A
@tkhatibi
tkhatibi / react-native-problems.md
Created November 16, 2016 18:10
React Native Problems

React Packager not reloading

In file react-native\packager\react-packager\src\node-haste\FileWatcher\index.js you can increase "MAX_WAIT_TIME" variable. such: 360000. and change function "_createWatcher" to :

_createWatcher(rootConfig) {
  const watcher = new WatcherClass(rootConfig.dir, {
    glob: rootConfig.globs,
    dot: false,
 });