Skip to content

Instantly share code, notes, and snippets.

View umkasanki's full-sized avatar

Oleg Tishkin umkasanki

View GitHub Profile
Garnish.on(Craft.BaseElementIndex, 'updateElements', (ev) => {
// ev.target = the element index
});
$languages = [
'ab' => 'Abkhazian',
'aa' => 'Afar',
'af' => 'Afrikaans',
'ak' => 'Akan',
'sq' => 'Albanian',
'am' => 'Amharic',
'ar' => 'Arabic',
'an' => 'Aragonese',
'hy' => 'Armenian',
{# based on Postmark Transactional Email Templates
https://postmarkapp.com/transactional-email-templates #}
{# If you change button color, remember to pass it to macro AND define "buttonColor" before "extends" tag. #}
{# macro title #}
{% macro title(titleText) %}
{% if titleText is defined %}
<h1 style="margin-top: 0; color: #333333; font-size: 22px; font-weight: bold; text-align: center;" align="left">{{titleText}}</h1>
{% endif %}
const debounce = (delay, fn) => {
let inDebounce = null;
return args => {
clearTimeout(inDebounce);
inDebounce = setTimeout(() => fn(args), delay);
}
}
Seven different types of CSS attribute selectors
// This attribute exists on the element
[value]
// This attribute has a specific value of cool
[value='cool']
// This attribute value contains the word cool somewhere in it
[value*='cool']
@tomasevich
tomasevich / remove-all-from-docker.md
Last active April 18, 2025 10:42 — forked from beeman/remove-all-from-docker.sh
Удалить/очистить все данные Докера (контейнеры, образы, тома и сети)

Удалить/очистить все данные Докера (контейнеры, образы, тома и сети)

Одной строкой

docker stop $(docker ps -qa) && docker rm $(docker ps -qa) && docker rmi -f $(docker images -qa) && docker volume rm $(docker volume ls -q) && docker network rm $(docker network ls -q)

Описание команд

@croxton
croxton / google_cloud_storage_craft_3.md
Last active September 24, 2022 07:31
How to provision Google Cloud Storage buckets for Craft CMS 3.x

Create the bucket

  1. Open the console https://console.cloud.google.com
  2. If you haven't already, setup your Cloud billing account
  3. From the drop down at the top of the screen, create new project for your client, e.g. my-client
  4. Make a note of the Project number on the project Home screen (Craft refers to this as the Project ID)
  5. In the sidebar go to APIs & Services > Credentials, click the + Create credentials button and choose the Service Account type
  • Set account name to craft-cms or similar
  • Set role to Owner
  • Save
  1. Click on the newly created service account email to edit it, then click the Keys tab and click Add key > Create new key and select the JSON format
@juban
juban / app.php
Last active July 11, 2024 17:03
Redis configuration for Craft CMS
<?php
/**
* Yii Application Config
*
* Edit this file at your own risk!
*
* The array returned by this file will get merged with
* vendor/craftcms/cms/src/config/app/main.php and [web|console].php, when
* Craft's bootstrap script is defining the configuration for the entire
* application.
{# v2 #}
{% if pagination_list is defined %}
{% js %}
// AJAX REQUEST DATA
{% set current_url = craft.request.getRequestUri()|split(craft.request.getPath())[0]~craft.request.getPath() %}
{% set ajax_data = {
current_url: current_url,
pagination_list: pagination_list|hash,
pagination_parameters: pagination_parameters ?? null,
@umkasanki
umkasanki / .twig
Last active November 20, 2022 15:32
Craftcms. nested categories in entry url
Expertise channel settings:
Entry URI Format: expertise/{category.inReverse().one().uri}/{slug}
Category group settings:
Category URI Format: {parent.uri}/{slug}