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
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); | |
echo $lang; |
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 | |
use ReCaptchaSecureToken\ReCaptchaToken as ReCaptchaToken; | |
require_once("ReCaptchaToken.php"); | |
//Generate recaptcha token | |
$recaptcha_config = [ | |
'site_key' => 'your-site-key', | |
'site_secret' => 'your-site-secret-key' | |
]; | |
$recaptcha_token = new ReCaptchaToken($recaptcha_config); |
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
//.htaccess code | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA] | |
//PHP part |
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
tar cvpzf backup.tgz --exclude='dir_to_exculde/*' * | |
tar cvpzf backup.tgz --exclude='dir_to_exculde/*' | |
--exclude='dir_to_exculde' * | |
//The last asteric means that the current dir is used. Keep in mind that files with a dot aren't included. | |
//The secound example excludes also the directory from being included otherwise it would be included as empty one... |
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
uasort($array_to_sort, function($a, $b) | |
{ | |
return $a['order'] - $b['order']; | |
}); |
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
phonegap plugin add cordova-plugin-app-version --save | |
/* | |
'--save' command also saves the plugin in the config.xml | |
*/ |
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
/** | |
* find out if child is first level child of given GO | |
* @return Transform | |
**/ | |
bool IsFirstLevelChildOf(Transform root, Transform child) | |
{ | |
bool isFirstLevel = false; | |
var children = root.GetComponentsInChildren<Transform>(); | |
foreach(var c in children) { | |
if (c.parent == root && c == child) { |
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
void Start () | |
{ | |
StartCoroutine (LateStart()); | |
} | |
IEnumerator LateStart() | |
{ | |
yield return new WaitForEndOfFrame (); | |
// Do your magic here! |
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
//installs "packagename" latest version | |
composer require vendorname/packagename | |
//installs package version 1.2 | |
composer require vendorname/packagename 1.2 | |
//installs package version above 1.2 but lesser then 2.0 | |
composer require vendorname/packagename 1.2.* | |
//installs package version above 1.2 but lesser then 2.0 |
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
var input_string = document.getElementById('my-input').innerText; | |
var output_element = document.getElementById('my-output'); | |
//here we go | |
var right_text = input_string.substring(0, input_string.indexOf(":")); | |
output_element.innerText = right_text; |