Skip to content

Instantly share code, notes, and snippets.

View MatthieuScarset's full-sized avatar
🤷‍♂️
Probably me

MattGyver MatthieuScarset

🤷‍♂️
Probably me
View GitHub Profile
@MatthieuScarset
MatthieuScarset / reset_admin_password.sql
Created June 19, 2018 22:45
SQL query to reset admin password (admin / admin)
UPDATE users SET pass ='$S$DmWStgEK4Uwao1iqvQeHJibfO6bE/x9EQ0A40qqSrV6T24UW9uAd' WHERE uid = 1;
// Colors
$black: #000000;
$grey: #f4f4f4;
$pale-grey: #6c94a3;
$white: #ffffff;
$navy: #004057;
$blue: #00aac0;
$pale-blue: #eff7f9;
$purple: #5d1f84;
$pink: #e461bc;
@MatthieuScarset
MatthieuScarset / .lando.yml
Last active August 15, 2024 14:31
Correct settings for XDebug + VSCode + Lando (+3.0)
# Lando version is at least +3.0
name: drupal-nine
recipe: drupal9
services:
appserver:
webroot: web
xdebug: debug
config:
php: .vscode/php.ini
@MatthieuScarset
MatthieuScarset / drupal8_programatically_delete_content.php
Last active August 28, 2024 05:55
Programatically delete content in Drupal 8
// Enable Devel module and go to /devel/php
$nodes = \Drupal::entityQuery("node")
->condition('created', strtotime('-30 days'), '<=')
->execute();
$storage_handler = \Drupal::entityTypeManager()->getStorage("node");
// $entities = $storage_handler->loadMultiple(); // Delete ALL nodes.
$entities = $storage_handler->loadMultiple($nodes);
$storage_handler->delete($entities);
echo stats | nc 127.0.0.1 11211*
memcached -u www-data -vv
@MatthieuScarset
MatthieuScarset / keybindings.json
Last active February 10, 2025 08:42
VSCode MacOS keybindings
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "ctrl+shift+down",
"command": "editor.action.moveLinesDownAction",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+up",
"command": "editor.action.moveLinesUpAction",
@MatthieuScarset
MatthieuScarset / metatag_entity.php
Created August 2, 2017 15:25
Programmatically assign meta tags to an entity
// @see https://www.drupal.org/docs/8/modules/metatag
$entity_type = 'node';
$values = [
'nid' => NULL,
'type' => 'article',
'title' => 'Testing metatag creation',
'uid' => 1,
'status' => TRUE,
'field_meta_tags' => serialize([
@MatthieuScarset
MatthieuScarset / gist:fe4413e174d674f11197b03c6957def6
Created June 27, 2017 18:21
Drupal 8 - Test if is an Ajax Form
if ($form_state->getUserInput()['_drupal_ajax']) {
// Display message into the Ajax form returned.
$form['warnings'] = ['#type' => 'status_messages', '#weight' => -1];
}
@MatthieuScarset
MatthieuScarset / .profile
Created June 15, 2017 19:40
Custom .profile file with custom BIN paths
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
@MatthieuScarset
MatthieuScarset / sonar-project.properties
Created June 12, 2017 17:35
Default Sonar properties for Drupal 8 project
# must be unique in a given SonarQube instance
sonar.projectKey=ONE80WEB:ONE80WEB
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=WEBSITE
sonar.projectVersion=1.0
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# This property is optional if sonar.modules is set.
sonar.sources=./web