This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Oracle Database Connection Wrapper. | |
@author: Mohamed Riyad <@RyadPasha> | |
@url: http://ryadpasha.com | |
@email: me@ryadpasha.com | |
@license: MIT License | |
""" | |
import cx_Oracle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Download a large distant file to a local destination. | |
* | |
* This method is very memory efficient :-) | |
* The file can be huge, PHP doesn't load it in memory. | |
* | |
* /!\ Warning, the return value is always true, you must use === to test the response type too. | |
* | |
* @author Mohamed Riyad <@RyadPasha> | |
* @url: http://ryadpasha.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mime2ext($mime) { | |
$mime_map = [ | |
'video/3gpp2' => '3g2', | |
'video/3gp' => '3gp', | |
'video/3gpp' => '3gp', | |
'application/x-compressed' => '7zip', | |
'audio/x-acc' => 'aac', | |
'audio/ac3' => 'ac3', | |
'application/postscript' => 'ai', | |
'audio/x-aiff' => 'aif', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Connecting to database in Java with JDBC 3.0 and backward. | |
* | |
* @author: Mohamed Riyad <@RyadPasha> | |
* @url: http://ryadpasha.com | |
* @email: me@ryadpasha.com | |
* @license: MIT License | |
*/ | |
import java.sql.Connection; | |
import java.sql.DriverManager; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @project: PHP File Uploader | |
* | |
* @purpose: This fuction provides a full secure file upload in PHP. | |
* @version: 1.0 | |
* | |
* | |
* @author: Mohamed Riyad | |
* @created on: 9 Jun, 2019 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function conv2EnNum(str){ | |
return parseFloat(str | |
.replace(/[٠١٢٣٤٥٦٧٨٩]/g, function (d) { return d.charCodeAt(0) - 1632; }) // Convert Arabic numbers | |
.replace(/[۰۱۲۳۴۵۶۷۸۹]/g, function (d) { return d.charCodeAt(0) - 1776; }) // Convert Persian numbers | |
)*1; | |
} | |
// Examples: | |
alert(conv2EnNum('٠١٢٣٤٥٦٧٨٩')); // -> 01213456789 | |
alert(conv2EnNum('١٣.٥')); // -> 13.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function conv2EnNum($str) { | |
$str = str_replace(['٠','١','٢','٣','٤','٥','٦','٧','٨','٩'], range(0, 9), $str); // Convert Arabic numbers | |
$str = str_replace(['۰','۱','۲','۳','۴','۵','۶','۷','۸','۹'], range(0, 9), $str); // Convert Persian numbers | |
return preg_replace('/[^0-9\.,]/', '', $str); | |
} | |
echo conv2EnNum('٠١٢٣٤٥٦٧٨٩'); // -> 01213456789 | |
echo conv2EnNum('١٣.٥'); // -> 13.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* sends a request to the specified url from a form. this will change the window location. | |
* @param {string} path the path to send the post request to | |
* @param {object} params the paramiters to add to the url | |
* @param {string} [method=post] the method to use on the form | |
*/ | |
function post(path, params, method='POST') { | |
// The rest of this code assumes you are not using a library. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* sends a request to the specified url from a form. this will change the window location. | |
* @param {string} path the path to send the post request to | |
* @param {object} params the paramiters to add to the url | |
* @param {string} [method=post] the method to use on the form | |
*/ | |
function post(path, params, method='POST') { | |
var form = $('<form></form>'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# remove .DS_Store file from GitHub that macOS creates | |
# find and remove .DS_Store | |
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch | |
# create .gitignore file, if needed | |
touch .gitignore | |
echo .DS_Store > .gitignore | |
# push changes to GitHub |
OlderNewer