Skip to content

Instantly share code, notes, and snippets.

@aisteron
aisteron / remove-all-from-docker.sh
Last active September 26, 2023 06:26 — forked from beeman/remove-all-from-docker.sh
Remove all from Docker
View remove-all-from-docker.sh
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
View load stack js libs
function $_(element) { return document.querySelector(element) }
let stack = [
'/js/autocomplete/jquery-1.12.4.js',
'/js/autocomplete/jquery-ui.js',
'/js/autocomplete/loadcss.js',
]
View load stack of js
function loadFancy() {
let stack = [
'/vendor/jquery.min.js',
'/vendor/jquery.fancybox.min.js',
'/vendor/loadcss.js'
]
loadIt()
@aisteron
aisteron / gist:9c7867b4f20b065fc21194c7913dad02
Created February 20, 2019 13:43
modx сортировка по просмотрам
View gist:9c7867b4f20b065fc21194c7913dad02
//- Сортировка по популярным постам
# 1. Устанавливаем плагин HitsPage;
# 2. Создаем дополнительное поле HitsPage с типом — число.
# 3. В шаблоне, где надо выводить просмотры пишем [[!HitsPage? &saveTv=`true`]]
[[!pdoResources?
&parents=`4,5,6,7`
&tpl=`pop_tpl`
&limit=`3`
View поиск по тегам modx
//- вставляется в шаблоне "поиск по тегам"
//- https://youtu.be/5INOkXHP6xQ?t=2389
[[!pdoPage?
&tvFilters=`tags==%[[!#GET.tag]]%`
&parents=`3`
&tpl=`blog-item`
&sortby=`{ "pagetitle":"ASC" }`
]]
@aisteron
aisteron / mdx_ajax
Created January 23, 2019 12:35
modx ajax snippet
View mdx_ajax
<?php
/*$page = $modx->getObject('modResource', 13);
$chars = json_decode($page->getTVValue('chars'));
echo '<pre>';
foreach($chars as $k => $v)
{
echo $v->key0.'-'.$v->value0;
}
View gist:f2155feaca8591fedabac58f52280ceb
$where = array(
'parent' => 6
);
$resources = $modx->getCollection('modResource',$where);
$output = '<p>Всего ресурсов: '.count($resources).'</p>';
foreach ($resources as $k => $res) {
$output .= '<p>['.$k.'] => '.$res->get('pagetitle').'</p>';
}
print $output;
@aisteron
aisteron / Gruntfile.js
Created December 6, 2018 17:43
default Gruntfile.js
View Gruntfile.js
module.exports = function(grunt){
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
pug:
{
compile: {
options: {
@aisteron
aisteron / package.json
Last active December 6, 2018 18:09
default package.json
View package.json
{
"name": "ct.fzn.by-jqm",
"version": "0.0.1",
"devDependencies": {
"grunt": "latest",
"grunt-browser-sync": "latest",
"grunt-contrib-concat": "latest",
"grunt-contrib-pug": "latest",
"grunt-contrib-watch": "latest",
"grunt-critical": "latest",