This file contains hidden or 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
/** | |
* Check if string has an arabic char | |
* @author Mohammed Alashaal <fb.com/alash3al> | |
* @param element str | |
* @return bool | |
*/ | |
function has_ar(str) | |
{ | |
var x = /[\u0600-\u06FF]+/; | |
return x.test(str); |
This file contains hidden or 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 | |
/** | |
* Convert array/nested-array to single value | |
* @param mixed $arg | |
* @author Mohammed Al Ashaal | |
* @license MIT License | |
* @return string | |
*/ | |
function array2val($arg) |
This file contains hidden or 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 | |
/** | |
* Session initializer | |
* this function will check whether the session already started or not | |
* if it started then it will not start it again | |
* @author Mohammed Al Ashaal | |
*/ | |
function session_init() | |
{ |
This file contains hidden or 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 | |
/** | |
* A function to extract links from source | |
* @version 1.0 | |
* @author Mohammed Al Ashaal | |
* @copyright 2014 | |
* @license New BSD License | |
*/ | |
if ( ! function_exists('extract_links') ): |
This file contains hidden or 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 | |
// here we handle all form errors | |
$GLOBALS['formE'] = array(); | |
// say that some hit the submit button | |
// and the form method is POST | |
if ( isset( $_POST['submit'] ) ) | |
{ | |
// create a shortcut to $_POST var |
This file contains hidden or 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 | |
/** | |
* wget just like linux wget command | |
* | |
* @author Mohammed Al Ashaal <is.gd/alash3al> | |
* @version 1.0.0 | |
* @license MIT License | |
* | |
* @param string $url example 'http://site.com/xxx?k=v' | |
* @param string $method example 'GET' |
This file contains hidden or 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
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
This file contains hidden or 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 | |
/** | |
* wget, the curl alternative | |
* | |
* @author Mohammed Al Ashaal <is.gd/alash3al>, <fb.com/alash3al> | |
* @version 2.0.0 | |
* @license MIT License | |
* | |
* @param string $url example 'http://site.com/xxx?k=v' |
This file contains hidden or 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
/** | |
* File2Base64 | |
* | |
* @param string file the path of the files | |
* @param string mim_type the type of the file e.g: 'image/png' | |
* @param callable callback the callback that handle the base64encoded string | |
* | |
* @author Mohammed Al Ashaal | |
* @version 1.0.0 | |
*/ |
This file contains hidden or 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
/** | |
* Parse a url and return its components | |
* | |
* @param string $url | |
* @return Object | |
* | |
* @author Mohammed Al Ashaal <is.gd/alash3al>, inspired by PHP | |
* @version 1.0.0 | |
*/ | |
function parse_url($url) |
OlderNewer