Skip to content

Instantly share code, notes, and snippets.

Install Drupal CS using Composer

1. Install composer globally

Detailed information about this step can be found here.

2. Install PHP Code Sniffer and Coder

composer global require squizlabs/php_codesniffer ^2.9
composer global require drupal/coder ^8.2

3. Use Drupal standards by default

/**
* $(document).ready() block.
*/
$(document).ready(function() {
console.log("Document loaded!");
});
/**
* Shorthand for $(document).ready().
*/
@alan-ps
alan-ps / drupal7_first_install_update.md
Last active December 24, 2016 21:51
Drupal 7: use update functionality after first module installation.

Use code below in the .install file of your module (my_module).

<?php

/**
 * Implements hook_install().
 */
function my_module_install() {
  // Set an initial value for the schema version so we can run updates
 // after install (for first installation only).
@alan-ps
alan-ps / composer_drush.md
Last active October 5, 2018 17:19
Installing drush using composer

Install Drush using Composer

1. Install composer globally

Detailed information about this step can be found here.

2. Drush installation

composer global require drush/drush:8.*
composer global update

We can state any Drush version we need. We can also roll back to a necessary release version of Drush using commands above. Now, we can use Drush:

@alan-ps
alan-ps / sudo_without_pass.md
Last active October 13, 2021 19:47
Run sudo command without a password

In order to run any sudo commands without typing a password we should add next two lines into /etc/sudoers at the end of the file (use sudo for open this file).

User_Alias ADMINS = username
ADMINS ALL = NOPASSWD: ALL

where username is the user to whom permissions should be granted.