Skip to content

Instantly share code, notes, and snippets.

View lolandese's full-sized avatar
💭
My public code is on Drupal.org and Backdrop CMS

Martin Postma lolandese

💭
My public code is on Drupal.org and Backdrop CMS
View GitHub Profile
@lolandese
lolandese / unindent.php
Last active October 1, 2019 15:14
Removes excessive indenting that consist of spaces or tabs
<?php
$str = " This is a test
string spanning
multiple lines.
It contains three
sentences, each are
split on three lines.
The indentation decides
which lines belongs
to which sentence.";
@lolandese
lolandese / YamlSnippet2Array.php
Last active September 19, 2019 08:14
Convert a Drupal YAML snippet to an array as a working PHP code snippet to write its values to the database. This is code to generate code. Short URL: https://git.io/Jem8t
<?php
/**
* @file
* Convert YAML snippet to PHP code snippet to write its values to database.
*/
use Drupal\Component\Serialization\Yaml;
// Replace the input below with any part of a valid YAML snippet.
@lolandese
lolandese / Yaml2Array.php
Last active January 14, 2022 13:36
Convert a Drupal YAML configuration file to an array as a working PHP code snippet to write its values to the database. This is code to generate code. Short URL: https://git.io/fjjDu
<?php
/**
* @file
* Convert a YAML file to PHP code to write its values to the database.
*/
use Drupal\Component\Serialization\Yaml;
// Replace 'filter.format.full_html' with any other existing configuration
@lolandese
lolandese / languages-drupal.json
Last active September 6, 2019 18:04
Drupal languages
{"af":["Afrikaans","Afrikaans"],"am":["Amharic","\u12a0\u121b\u122d\u129b"],"ar":["Arabic","\u0627\u0644\u0639\u0631\u0628\u064a\u0629","rtl"],"ast":["Asturian","Asturianu"],"az":["Azerbaijani","Az\u0259rbaycanca"],"be":["Belarusian","\u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f"],"bg":["Bulgarian","\u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438"],"bn":["Bengali","\u09ac\u09be\u0982\u09b2\u09be"],"bo":["Tibetan","\u0f56\u0f7c\u0f51\u0f0b\u0f66\u0f90\u0f51\u0f0b"],"bs":["Bosnian","Bosanski"],"ca":["Catalan","Catal\u00e0"],"cs":["Czech","\u010ce\u0161tina"],"cy":["Welsh","Cymraeg"],"da":["Danish","Dansk"],"de":["German","Deutsch"],"dz":["Dzongkha","\u0f62\u0fab\u0f7c\u0f44\u0f0b\u0f41"],"el":["Greek","\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac"],"en":["English","English"],"en-x-simple":["Simple English","Simple English"],"eo":["Esperanto","Esperanto"],"es":["Spanish","Espa\u00f1ol"],"et":["Estonian","Eesti"],"eu":["Basque","Euskera"],"fa":["Persian, Farsi","\u0641\u0627\u0631\u0633
@cecilemuller
cecilemuller / 2019-https-localhost.md
Last active December 4, 2025 10:03
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

install homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

install latest PHP package

brew install [email protected]

@JPustkuchen
JPustkuchen / drupal8-settings-devel-kint-maxLevels-override.md
Last active June 26, 2023 07:59
Drupal 8 kint set maxLevels in settings.php to prevent out of memory

Currently devel doesn't allow to override KINT configuration in a clean way. Hopefully this will be possible some day via setting in UI or drupal setting override in settings.php Until this happens you may use this dirty trick in settings.php to override the setting.

See issues:

Simply copy this into your settings.php and change the value accordingly (Kint default: 7)

@fmfpereira
fmfpereira / gist:4186d4e40b09b2b49f2a4c91576be78c
Created December 18, 2017 18:02
Remove uuid, _core and default_config_hash from Drupal 8.x profile install config files.
sed -i "/^uuid:/d;/^_core:/d;/^ default_config_hash:/d" *
@grasmash
grasmash / acsf-cm.md
Last active August 22, 2022 15:31
Configuration management best practices for ACSF.

This tutorial covers common use cases for configuration splits as a strategy for configuration management in Drupal 8.

Specifically it covers:

  • Default application configuration
  • Environment specific configuration (e.g., local, data, test, prod, etc.)
  • Site-specific configuration (when multisite is used)
  • "Feature" specific configuration (e.g. a distinct blog feature that is shared across multiple sites). Not to be confused with the features module.
  • Miscellaneous troubleshooting information