Skip to content

Instantly share code, notes, and snippets.

View sberdyug's full-sized avatar

Сергей Бердюг sberdyug

View GitHub Profile
@sberdyug
sberdyug / gist:11185e99d2552b07c3dee03b3f88e46e
Created November 23, 2023 08:25 — forked from discordier/gist:ed4b9cba14652e7212f5
options for phpStorm @noinspection annotation
javascript
ES6ValidationInspection
JSAccessibilityCheckInspection
JSBitwiseOperatorUsageInspection
JSCheckFunctionSignaturesInspection
JSClosureCompilerSyntaxInspection
JSCommentMatchesSignatureInspection
JSComparisonWithNaNInspection
JSConsecutiveCommasInArrayLiteralInspection
@sberdyug
sberdyug / Model.php
Created July 15, 2022 11:23 — forked from forecho/Model.php
Yii 2 表单验证JSON 二维数据
/**k
* @inheritdoc
*/
public function rules()
{
return [
[['name', 'subtitle'], 'string', 'max' => 100],
['productInfo', 'vaildateProductInfo'], // 自定义验证
['skus', 'vaildateSkus'], // 自定义验证
];
@sberdyug
sberdyug / controller.php
Created July 15, 2022 11:20 — forked from forecho/controller.php
Yii2 使用 CoreSeek 搜索 Demo 更多信息参考官方文档 http://www.coreseek.cn/products-install/step_by_step/
public function actionSearch()
{
$keyword = Yii::$app->request->get('keyword');
if (empty($keyword)) $this->goHome();
require_once(Yii::getAlias('@common/helpers') . '/sphinxapi.php');
$cl = new \SphinxClient ();
$cl->SetServer('127.0.0.1', 9312);
//以下设置用于返回数组形式的结果
$cl->SetArrayResult(true);
@sberdyug
sberdyug / tree.php
Created July 15, 2022 11:15 — forked from forecho/tree.php
PHP 递归方法实现无限分类两种实例
<?php
/**
* @link http://ideone.com/gAsKlI
*/
$items = array(
array('id' => 1, 'pid' => 0, 'name' => '一级11'),
array('id' => 11, 'pid' => 0, 'name' => 'www.111cn.net 一级12'),
array('id' => 2, 'pid' => 1, 'name' => '二级21'),
array('id' => 10, 'pid' => 11, 'name' => '二级22'),
array('id' => 3, 'pid' => 1, 'name' => '二级23'),
@sberdyug
sberdyug / SearchModel.php
Created July 15, 2022 11:14 — forked from forecho/SearchModel.php
Yii2 Search Model
<?php
/**
* author : forecho <[email protected]>
* createTime : 2015/12/29 15:33
* description:
*/
namespace common\components;
use yii\base\InvalidParamException;
@sberdyug
sberdyug / slideshow.js
Last active June 29, 2022 22:11 — forked from Kcko/slideshow.js
(function ($) {
$.fn.slideShow = function (options) {
// Supplying default options
options = $.extend({
timeOut: 3000,
showNavigation: true,
pauseOnHover: true,
swipeNavigation: true
@sberdyug
sberdyug / pubsub.js
Created June 29, 2022 22:10 — forked from Kcko/pubsub.js
(function($) {
var o = $({});
var calledEvents = {};
$.subscribe = function() {
o.on.apply(o, arguments);
if (arguments[0] in calledEvents)
/*
* jQuery Autocomplete plugin 1.2.3
*
* Copyright (c) 2009 Jörn Zaefferer
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* With small modifications by Alfonso Gómez-Arzola.
/*
* jQuery Plugin: Tokenizing Autocomplete Text Entry
* Version 1.6.2
*
* Copyright (c) 2009 James Smith (http://loopj.com)
* Licensed jointly under the GPL and MIT licenses,
* choose which one suits your project best!
*
*/
;(function ($) {
@sberdyug
sberdyug / jquery-selector.js
Created June 29, 2022 21:58 — forked from Kcko/jquery-selector.js
jquery simple plugins
(function($) {
$.extend($.expr[':'], {
group: jQuery.expr.createPseudo(function(num) {
return function(elem) {
if (isNaN(num)) {
return false;
}
return ($(elem).index() - 1) % (num * 2) < num;
};