Skip to content

Instantly share code, notes, and snippets.

View BumbuKhan's full-sized avatar

Gurban Gurbanov BumbuKhan

  • @Develolper
  • Azerbaijan, Baku
View GitHub Profile
@BumbuKhan
BumbuKhan / PostgreSQL
Created April 20, 2017 08:34
How to view command line history, bash?
history
@BumbuKhan
BumbuKhan / PostgreSQL
Created April 20, 2017 08:29
How to deploy database dump in PostgreSQL
psql -U postgres dt < /path/to/dump.sql
@BumbuKhan
BumbuKhan / yii2
Created April 13, 2017 09:27
Selectbox in gridview
GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'user_id',
// 'filter' => array("1" => "open", "2" => "in progress", "3" => "closed")
'filter' => ArrayHelper::map(\app\models\User::find()->asArray()->all(), 'id', 'username')
@BumbuKhan
BumbuKhan / Angular2
Last active March 30, 2017 22:00
Angular2 install
HOW TO INSTALL Angular2:
1) Install Node platform
2) Run 'npm install -g angular-cli'
'-g' stands for 'global'
'angular-cli' is a Command Line Interface which allows easly interact with angular while developing
3) Create your project by typing 'ng new <Your-project-name>'
4) Navigate to the folder <Your-project-name> and run 'ng serve'
it will build a project, run server on URL 'http://localhost:4200' and start watching for changes in code, once file is changed project will be rebuilt the project and browser will be automatically refreshed
@BumbuKhan
BumbuKhan / PostgreSQL
Last active March 2, 2017 14:46
Work with tables in PostgreSQL
List of available databases: \l
List of available tables: \dt
Choose table: \c <table_name>
Quit session: \q
@BumbuKhan
BumbuKhan / jQuery
Created February 20, 2017 12:35
Event binding to dynamic DOM elements
$(document).on("click", "#test-element", function() {
alert("click bound to document listening for #test-element");
});
$('body').append('<div id="test-element">Click mee</div>');
@BumbuKhan
BumbuKhan / Yii2
Created February 17, 2017 08:45
How to replace Yii::t('app', 'lang-key') to tag's data attribute (in notepad++)
Finf what: > ?<\?= ?Yii::t\('app',\ '(.*)'\);? ?\?>
Replace with: data-lang-key="\1">
Example:
<a href="javascript:void(0)" class="weather" title="Precipitation"><?= Yii::t('app', 'weather');?></a>
will be raplced to
<a href="javascript:void(0)" class="weather" title="Precipitation" data-lang-key="weather"></a>
@BumbuKhan
BumbuKhan / Notepad++
Created February 17, 2017 08:39
How to use found by regex string in replacement
Find: <\?= ?Yii::t\('app',\ '(.*)'\);? ?\?>
Replace with: \1
@BumbuKhan
BumbuKhan / Yii2
Created February 16, 2017 13:52
How to pass variable to layout
// in controller
Yii::$app->view->params['message_to_layout'] = 'This message will be shown in layout';
// in layout (and in any view!)
<?=$this->params['message_to_layout']?>
@BumbuKhan
BumbuKhan / css
Created February 15, 2017 08:08
clearfix
.clearfix::before, .clearfix::after {
content: "";
display: table;
}
.clearfix::after {
clear: both;
}
.clearfix {