Skip to content

Instantly share code, notes, and snippets.

@PriymakVl
PriymakVl / jquery.js
Created May 2, 2020 16:21
jquery event click mouse
$('selector').mousedown(function(event) {
console.log(event.which);
//1 - left button mouse click
//2 - middle button mouse click
//1 - right button mouse click
});
@PriymakVl
PriymakVl / css.html
Created May 2, 2020 05:49
css font weight
100 – Thin || Hairline
200 – Extra Light || Ultra Light || Thin
300 – Light
400 – Normal || Regular
500 – Medium
600 – Semi Bold || Demi Bold
700 – Bold
800 – Extra Bold || Ultra Bold || Heavy
@PriymakVl
PriymakVl / yii.php
Last active April 30, 2020 08:02
yii rules trim
<?
// https://forum.yiiframework.com/t/how-to-trim-a-field-for-a-model/34467
public function rules()
{
return [i
[['engl', 'ru'], 'filter', 'filter' => 'trim'],
];
}
@PriymakVl
PriymakVl / wordpress.php
Last active May 3, 2020 05:31
wordpress menu
<?php
// registered in file functions
add_action( 'after_setup_theme', 'theme_register_nav_menu' );
// register_nav_menu( $location, $description );
function theme_register_nav_menu() {
register_nav_menu( 'primary', 'Primary Menu' );
// register_nav_menus( array( $location => $description ) ); with version 3.0
@PriymakVl
PriymakVl / yii.php
Last active April 29, 2020 18:45
yii pagination
<?php
use yii\data\Pagination
//Controller action
public function actionIndex()
{
$query = Article::find()->where(['status' => 1]);
$countQuery = clone $query;
$pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize' => 5]);
$models = $query->offset($pages->offset)
@PriymakVl
PriymakVl / wordpress.php
Last active April 29, 2020 14:25
wordpress url link
<?php
//need echo
site_url(); //home page
site_url('contacts'); //http://sitename/contacts
get_template_directory_uri(); //echo
home_url($path, $scheme); //https://wp-kama.ru/function/home_url
@PriymakVl
PriymakVl / wordpress.html
Last active April 29, 2020 14:12
wordpress theme create
<!-- create theme -->
<a href="https://www.youtube.com/watch?v=URFhyvZTENc&list=PL3LQJkGQtzc6Nwz67GGrMdqxim1c0H5DC&index=2">glo academy</a><br>
wp_content > themes > <folder theme> > style.css > /*Theme Name: test*/
<!-- files need -->
style.css
index.php
screenshot.png (1200px / 900 px) <!-- for show in console -->
@PriymakVl
PriymakVl / array.php
Created April 25, 2020 16:22
php get last key array
<?php
// get last key of array
// for php 7
echo array_key_last ($array);
// for php 5
// numeric array
echo $array[count($array) - 1];
@PriymakVl
PriymakVl / yii.php
Created April 24, 2020 17:39
yii active form
<?php
<?= $form->field($model, 'GrossPay')->textInput(['id'=>'GrossPay','readonly'=> true])?>
@PriymakVl
PriymakVl / gulp.js
Created April 24, 2020 06:32
gulp watch
//function css ...
function watchSass() {
gulp.watch('./scss/**/*', css);
}
gulp.task('default', watchSass);
//end watch in console Ctrl + C