Skip to content

Instantly share code, notes, and snippets.

@vistar
vistar / commands.md
Last active October 15, 2022 11:53
Linux Recipes

du -s *|sort -hr|cut -f 2-|while read a;do du -hs $a;done - get sorted sizes of all subdirectories

@vistar
vistar / launch.json
Last active September 17, 2022 09:22
Vscode settings for xdebug in docksal
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9000,
// server -> local
"pathMappings": {
@vistar
vistar / css.md
Last active March 27, 2022 18:34
RSS conspectus

‎‎​

@vistar
vistar / distributions.md
Last active April 21, 2022 17:27
Drupal bookmarks

Drupal 8/9 distributions

rm .git -rf
or
for dir in find . -name ".git"; do rm -rf $dir;
git rm --cached directory
git add directory
or
git add .
@vistar
vistar / composer_update.md
Created December 9, 2021 09:34
update drupal
  1. Список доступных обновлений composer outdated "drupal/*"

  2. Проверить, что используется: composer show drupal/core-recommended

2.1 если drupal/core-recommended composer update drupal/core "drupal/core-*" --with-all-dependencies

2.2 Если нет

@vistar
vistar / twig-cheat-sheet.md
Created July 27, 2021 12:48 — forked from AnneTee/twig-cheat-sheet.md
Drupal 8 Twig cheat sheet

D8 Twig cheat sheet

Conditionals

To check if a field has a value, check to see if the 0 array item is populated. Simply checking if content.field_name is truthy will not work since that variable will be defined even if the field is empty.

{% if content.field_name.0 %}
  {{ field_name }}
{% endif %}
@vistar
vistar / d9-remove-wrong-equal-translations-l10n.md
Last active April 23, 2022 15:54 — forked from JPustkuchen/d8-remove-wrong-equal-translations-l10n.md
Drupal 9 CMS: Delete equal customized translation (source language string = target language string)

Drupal 9 CMS: Delete equal customized translation (source language string = target language string)

If you should encounter the problem that some translations are wrongly translated with the equal source language string (for example in our case there were German translations for "Author" translated with "Author" or "Published" with "Published"), you may use the following snippet to list them.

SELECT s.lid,s.source, t.translation FROM `locales_source` s
INNER JOIN locales_target t
WHERE s.lid=t.lid AND CONVERT(s.source USING utf8) = CONVERT(t.translation USING utf8) 
AND t.customized=1

To finally delete them, you may use something like this, but make a backup before and know what you're doing!

@vistar
vistar / gist:ca27ebe3608e69846a24674bd8d0d331
Created January 22, 2020 20:43 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@vistar
vistar / docker-compose.yml
Created June 19, 2017 09:33
Default docker4drupal
version: "2"
services:
mariadb:
image: wodby/mariadb:10.1-2.1.0
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: drupal
MYSQL_USER: drupal
MYSQL_PASSWORD: drupal