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
Get the information of PHP | |
========================== | |
$ sudo apt show php | |
OR | |
$ sudo apt show php -a | |
$ sudo apt install php // this will install default php version ( may be 7.2 ) | |
T0 Install Different Versions Of PHP |
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 | |
public function getElementsByClass(&$parentNode, $tagName, $className) | |
{ | |
$nodes = array(); | |
$childNodeList = $parentNode->getElementsByTagName($tagName); | |
for ($i = 0; $i < $childNodeList->length; $i++) { | |
$temp = $childNodeList->item($i); | |
if (stripos($temp->getAttribute('class'), $className) !== false) { |
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
LIST OF MYSQL FUNCTIONS | |
======================= | |
show create table <table>; // displays the sql query similar to sql while creating | |
show fields from <table>; // displays the fields of table | |
show indexes from <table>; // displays the indexed of tabe ( foreign, unique, index etc. ) |
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 | |
class RandomUserAgent | |
{ | |
public $browser_frequency = [ | |
"Internet Explorer" => 11.8, | |
"Firefox" => 28.2, | |
"Chrome" => 52.9, | |
"Safari" => 3.9, | |
"Opera"=>1.8 |
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 | |
namespace common\components; | |
use yii\db\ActiveQuery as YiiActiveQuery; | |
/** | |
* Class providing additional features for yii\db\ActiveQuery. Add support for JSON and spatial data types. | |
* | |
* @since 0.0.1 |
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 | |
namespace common\components; | |
use Yii; | |
use yii\db\Expression; | |
use yii\db\ActiveRecord as YiiActiveRecord; | |
use yii\base\InvalidCallException; | |
/** |
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
Serialize deeply nested relations | |
================================= | |
https://github.com/yiisoft/yii2/issues/6844#issuecomment-131482508 |
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 $item = FileMeta::find()->where("JSON_EXTRACT(data, '$.user_id') = {$user_id} and JSON_EXTRACT(data, '$.type') = 'video'")->andWhere(['key' => 'showcase'])->one(); ?> |
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
#!/bin/bash | |
echo "Please, enter your username, it will be added to 'sudo' and 'docker' groups during the process." | |
read USERNAME | |
if [ -z "$USERNAME" ] ; then | |
echo "Exiting... Done." | |
exit | |
else | |
echo "Adding user to 'sudo' group..." |
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
jQuery("#{form-id}").yiiActiveForm("add",{ | |
"id": "field-id", | |
"name": "{field-name}", | |
"container": ".field-{field-id}", | |
"input": "#{field-id}", | |
"error": ".help-block", | |
"validate": function(attribute, value, messages, deferred, $form) { | |
yii.validation.required(value, messages, { | |
"message": "{message}" | |
}); |