Skip to content

Instantly share code, notes, and snippets.

View onmotion's full-sized avatar
:octocat:

Alexandr Kozhevnikov onmotion

:octocat:
View GitHub Profile
1. Запустить regedit и открыть раздел:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\WinLogon
2. Установить параметр AutoAdminLogon = 1
3. Добавить параметр DefaultUserName и присвоить ему имя пользователя,
с которым будет происходить автоматический вход в систему (в ХР он уже есть)
4. Добавить параметр DefaultPassword и присвоить ему пароль,
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'actions' => ['update'],
'allow' => true,
'matchCallback' => function ($rule, $action) {
ALTER TABLE c6iddis.market_price CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
-----------------------
for all schema
----------------------
USE INFORMATION_SCHEMA;
SELECT
CONCAT("ALTER TABLE `", TABLE_SCHEMA,"`.`", TABLE_NAME, "` CONVERT TO CHARACTER SET UTF8 COLLATE utf8_general_ci;")
AS MySQLCMD FROM TABLES
cd /path/to/humhub/protected
php yii search/rebuild
<?php
$db = Yii::$app->db;
$sql = $db->queryBuilder->batchInsert($table, $fields, $rows);
$db->createCommand($sql . ' ON DUPLICATE KEY UPDATE')->execute();
<?php
$dataProvider = new ActiveDataProvider([
'query' => $query->select('client.*')->joinWith(['r_cli_tt.tt'])->addSelect('SUM(r_cli_tt_potential_sellers_cnt) as potentialsSum')->groupBy(['client_id']),
]);
и соответственно добавить potentialsSum в модель
<?php
$result = Order::find()->select(['price', 'firstname', 'lastname'])->joinWith('user')->createCommand()->queryAll();
Array
(
[client_id] => f43e28ff
[client_name] => name
)
@onmotion
onmotion / self signed ssl cert (for nginx).md
Last active December 2, 2017 14:36
self signed ssl cert (for nginx)
openssl req -newkey rsa:2048 -sha256 -nodes -keyout hostname.key -x509 -days 365 -out hostname.pem -subj "/C=US/ST=New York/L=Brooklyn/O=Example Brooklyn Company/CN=hostname.com" && \

openssl x509 -in hostname.pem -out hostname.crt

html::-webkit-scrollbar {
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(59%, black), color-stop(0%, rgba(255, 255, 255, 0)));
background-image: -webkit-linear-gradient(top, black 59%, rgba(255, 255, 255, 0) 0%);
background-image: linear-gradient(to bottom, black 59%, rgba(255, 255, 255, 0) 0%);
background-size: 4px 3px;
background-repeat: repeat-y;
background-position: center center;
width: .7rem;
}
html::-webkit-scrollbar-button {
@onmotion
onmotion / BadgeForm.php
Last active January 31, 2018 11:45
Yii2 form model
<?php
namespace backend\models\forms;
use common\models\Badge;
use common\models\BadgeCountryAccess;
use Yii;
use yii\base\Model;
use yii\web\UploadedFile;
/**