Skip to content

Instantly share code, notes, and snippets.

@kerasai
kerasai / curl.sh
Created October 28, 2024 10:53
CURL with clean file name
#!/bin/bash
# Check if a URL was provided
if [ -z "$1" ]; then
echo "Usage: $0 <URL>"
exit 1
fi
# Assign the first argument to a variable
URL="$1"
@kerasai
kerasai / Tests.md
Last active January 29, 2025 15:46
DrupalCI Tests

Set up tests

Kernel tests

Requries core dev tools:

composer require drupal/core-dev
@kerasai
kerasai / !Robo-Setup.md
Last active February 19, 2025 19:35
Robo setup

Robo setup

Robo task runner setup steps, for use in Lando environment.

Require dependencies

lando composer require --dev drupal/coder \
  kerasai/robo-drupal \
 kerasai/robo-phpcs \
@kerasai
kerasai / README.md
Created February 27, 2025 13:54
Install NodeJS using NVM

README

Download, set executable, then run using desired NodeJS version and NVM version as arguments.

chmod +x install-nodejs-nvm.sh
install-nodejs-nvm.sh 22 0.40.1

To add to a .lando.yml file:

@kerasai
kerasai / basic_auth.md
Created March 10, 2025 22:07
Lando - Add Basic Auth

In .lando.yml:

proxy:
  appserver:
    - hostname: mysite.lndo.site
      middlewares:
        - name: CanBeAnything
          key: 'basicauth.users'
 value: 'lando:$$apr1$$5HI8Qwxp$$2/jNlE4mlQA0JPWblBSfy1'
@kerasai
kerasai / skip_existing.patch
Created July 11, 2025 02:25
Patch to allow default content to be reran and avoid error by skipping previously created content.
diff --git a/src/Importer.php b/src/Importer.php
index 423c8ff..cbc19e1 100644
--- a/src/Importer.php
+++ b/src/Importer.php
@@ -288,6 +288,11 @@ class Importer implements ImporterInterface {
$entity = $this->contentEntityNormalizer->denormalize(Yaml::decode($contents));
}
+ // Skip if exists.
+ if (\Drupal::service('entity.repository')->loadEntityByUuid($entity->getEntityTypeId(), $entity->uuid())) {