This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
last = log -1 HEAD | |
lst = log --oneline --name-status | |
ldf = log --oneline --name-status --diff-filter=$1 | |
lf = log --oneline -- $1 | |
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate | |
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Taken from https://www.drupal.org/docs/7/administering-drupal-7-site/clearing-or-rebuilding-drupals-cache | |
TRUNCATE cache_config; | |
TRUNCATE cache_container; | |
TRUNCATE cache_data; | |
TRUNCATE cache_default; | |
TRUNCATE cache_discovery; | |
TRUNCATE cache_dynamic_page_cache; | |
TRUNCATE cache_entity; | |
TRUNCATE cache_menu; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// original expression: 5 * (DATEDIFF(@E, @S) DIV 7) + MID('0123444401233334012222340111123400012345001234550', 7 * WEEKDAY(@S) + WEEKDAY(@E) + 1, 1) | |
// see: https://stackoverflow.com/a/6762805 | |
// Example | |
$sql_diff = "SELECT (5 * (DATEDIFF(date_expedie, date_enattentedimpression) DIV 7) + MID('0123444401233334012222340111123400012345001234550', 7 * WEEKDAY(date_enattentedimpression) + WEEKDAY(date_expedie) + 1, 1)) FROM `" . _DB_PREFIX_ . "orders` WHERE `id_order` = " . (int) $order->id . " AND `date_enattentedimpression` IS NOT NULL AND `date_enattentedimpression` IS NOT NULL"; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo 'alias drush="~/public_html/vendor/bin/drush"' >> ~/.bashrc | |
source ~/.bashrc | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_preprocess_html(). | |
* | |
* @param type $variables | |
*/ | |
function THEMENAME_preprocess_html(&$variables) { | |
if (isset($variables['root_path'])) { | |
switch ($variables['root_path']) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$nid = \Drupal::routeMatch()->getRawParameter($node_id); // To get node id from url | |
$node = \Drupal::entityTypeManager()->getStorage('node')->load($nid); // To load node data using nid via entity manager | |
$node = Node::load($nid); // To load node data using nid via static call | |
$title = $node->getTitle(); // To get node title. Returns $node->get('title')->value; | |
if (!empty($node->field_name)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc | |
# or: sed -i '1i export PATH="$HOME/.composer/vendor/bin:$PATH"' $HOME/.bashrc | |
source $HOME/.bashrc | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
composer show | grep drupal/console | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
composer update drupal/core --with-dependencies | |