Skip to content

Instantly share code, notes, and snippets.

@webbash
webbash / laravel-builder-where-json-fields.php
Last active June 25, 2019 13:57
Laravel Eloquent JSON fields where query
<?php
return $query->whereJsonContains('fields', ['sub-field' => 'value'])
mongorestore --gzip --db $DB_NAME --drop $PATH/
Установить Docker CE и docker-compose на систему, если у вас MacOS или Windows
вы можете скачать установщик с офф. сайта
https://www.docker.com/get-started
Если же у вас Linux проводим установку как указано здесь:
https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce
Далее устанавливаем docker-compose
https://www.digitalocean.com/community/tutorials/how-to-install-docker-compose-on-ubuntu-16-04
// Изменяем функцию сохранения контента в файл
public function onSave()
{
if (!$this->checkEditor())
return;
$fileName = post('file');
// Format <p> delete
// Вторым параметро указываем те теги, которые разрешаем к допуску
$formattedContent = strip_tags(post("content"), '<a></a>');
<?php
// Скрипт формирования уникального ключа формы
session_start();
if($_SESSION["verify"])
{
unset($_SESSION["verify"]);
}
$_SESSION["verify"]=md5(uniqid(rand(),1));
<?php
$id = $_GET['id'];
if ($res = $modx->getObject('modResource',intval($id))) {
if(intval($res->get('template')) == 2)
{
$js ="
<script type='text/javascript'>
Ext.onReady(function () {
var tb = Ext.getCmp('modx-action-buttons');
//p.obj_header_insert.before( t.param.htmltable.header_cell.replace( '<!--ph-->', p.data.h[ i ].c.replace( /xxx&quot/g, '"' ) ) );
// input-v4.js
<?php $posts = get_posts([
'post_type' => 'slider'
]);
foreach ($posts as $post) :
$imgObj = get_post_meta($post->ID, 'image', true);
$label = get_post_meta($post->ID, 'definition', true);
echo "<pre>";
var_dump($imgObj, $label);
echo "</pre><br>";
Utils\Planb::pretty_print($arResult, false, false);
@webbash
webbash / Фикс для шрифтов с прыгающими цифрами
Created April 5, 2017 20:09
заменить минускульные цифры на маюскульные
font-variant-numeric: lining-nums
-moz-font-feature-settings: "lnum"
-webkit-font-feature-settings: "lnum"
font-feature-settings: "lnum"