Skip to content

Instantly share code, notes, and snippets.

View zuhairkareem's full-sized avatar
🏠
Working from home

zuhairkareem

🏠
Working from home
View GitHub Profile
@zuhairkareem
zuhairkareem / d8_config_issues.md
Created April 28, 2019 19:21
D8 Install config issues
drush ev '\Drupal::entityManager()->getStorage("shortcut_set")->load("default")->delete();';
@zuhairkareem
zuhairkareem / lando_wordpress_header.md
Created April 11, 2019 14:19
Lando Wordpress Header Issue
lando ssh --service appserver --user root --command "a2enmod headers"
lando ssh --service appserver --user root --command "service apache2 restart"
@zuhairkareem
zuhairkareem / drupal_drush_commands.md
Last active November 14, 2019 06:03
Helpful Drupal Drush Commands

Install D8 using drush

../vendor/drush/drush/drush si standard --db-url=mysql://dbusername:dbpassword@localhost/dbname --site-name='Site Name'

lando drush si standard --db-url=mysql://drupal8:drupal8@database/drupal8 --site-name='d8composer'

Disable module manually

// Read the configuration.
@zuhairkareem
zuhairkareem / alter_views_d8.md
Last active January 21, 2019 09:07
Hide field based on other field value - Views programatically Drupal 8
/**
 * Implements hook_views_pre_render().
 */
function MODULENAME_views_pre_render(\Drupal\views\ViewExecutable &$view) {
  if ($view->id() == 'views_machine_name'  && $view->current_display == 'views_display_name') {
    $result = $view->result;
 foreach ($result as $i => $row) {
@zuhairkareem
zuhairkareem / config.fish.md
Created September 12, 2018 07:31
Fish Config

vim ~/.config/fish/config.fish

alias drupalcs="phpcs --standard=Drupal --extensions='php,module,inc,install,test,profile,theme,css,info,txt,md'"
alias drupalcsp="phpcs --standard=DrupalPractice --extensions='php,module,inc,install,test,profile,theme,css,info,txt,md'"
alias drupalcbf="phpcbf --standard=Drupal --extensions='php,module,inc,install,test,profile,theme,css,info,txt,md'"

set -x ANDROID_HOME $HOME/Android/Sdk
set -x PATH $PATH $ANDROID_HOME/tools
set -x PATH $PATH $ANDROID_HOME/tools/bin
@zuhairkareem
zuhairkareem / sudo_error.md
Last active August 4, 2022 17:38
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set error in Ubuntu 18.04

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set error in Ubuntu

To fix

  1. If root user is not set, goto recovery mode, select drop as root shell prompt, then it will goto root prompt, run
mount -o remount,rw /
@zuhairkareem
zuhairkareem / ubuntu_18_04.md
Last active December 26, 2018 15:53
Ubuntu 18.04 Installation

To fix dependency errors

If you get following error while installing php7.1-bcmath extension

The following packages have unmet dependencies:
 php7.1-bcmath : Depends: php7.1-common (= 7.1.17-0ubuntu0.17.10.1) but 7.1.17-1+ubuntu17.10.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages
@zuhairkareem
zuhairkareem / drupal_core_upgrade.md
Last active April 2, 2018 10:08
Drupal Core Upgrade

These are the ways you could upgrade core for 7 & 8

Drupal 7

  1. Take back up of files and db
  2. Put site in maintenance mode.
  3. Delete all files except the "sites" folder and any files such as ".htaccess" and "robots.txt" that have been customized.
  4. Download latest D7 version and upload the new files except the sites directory or the .htaccess or .robots.txt files.
  5. If changes have been made to robots.txt or .htaccess in the new version ensure these are incorporated into your version.
  6. Run Update.php by visiting yourdomain.com/update.php