This file contains 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
# Rename the branch locally | |
git branch -m old-branch-name new-branch-name | |
# Push the renamed branch and set upstream | |
git push origin -u new-branch-name | |
# Delete the old branch from the remote repository | |
git push origin --delete old-branch-name | |
# Clean up local branches (optional) |
This file contains 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 | |
use Drupal\Core\Datetime\DrupalDateTime; | |
// Check if the event's end date is not present | |
// or has been passed. | |
$current_time = new DrupalDateTime('now', 'UTC'); | |
if ($entity->get('field_event_end_date')->isEmpty() || ($current_time->getTimestamp() >= $entity->field_event_end_date->date->getTimestamp())) { | |
} | |
?> |
This file contains 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 | |
/** | |
* Private file path: | |
* | |
* A local file system path where private files will be stored. This directory | |
* must be absolute, outside of the Drupal installation directory and not | |
* accessible over the web. | |
* | |
* Note: Caches need to be cleared when this value is changed to make the | |
* private:// stream wrapper available to the system. |
This file contains 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
// Following steps are to setup Acquia BLt with Drupal 10 which is a kind of work around till gets resolved. | |
// These steps assuming you have all pre-requisuites done | |
// https://docs.acquia.com/blt/install/ | |
// https://docs.acquia.com/blt/install/adding-to-project/ | |
// Main point here is The Drupal root must be in a top-level "docroot" directory. | |
1. composer create-project --no-interaction --no-install drupal/recommended-project drupalblt | |
2. cd drupalblt | |
3. sudo sed -i '' -e "s|web/|docroot/|g" composer.json (replacing web/ with doctroot/ to make docroot the top-level directory) | |
4. composer require --dev thegbomb/blt-ddev |
This file contains 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
// Dowload form_mode_manager from git and using composer. | |
"repositories": [ | |
{ | |
"type": "composer", | |
"url": "https://packages.drupal.org/8", | |
"exclude": [ | |
"drupal/form_mode_manager" | |
] | |
}, | |
{ |
This file contains 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 declare(strict_types = 1); | |
namespace Drupal\custom_search\EventSubscriber; | |
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | |
use Symfony\Component\HttpKernel\Event\RequestEvent; | |
use Symfony\Component\HttpKernel\Event\ResponseEvent; | |
use Symfony\Component\HttpKernel\KernelEvents; | |
use Drupal\search_api_solr\Event\PreQueryEvent; | |
use Drupal\search_api_solr\Event\SearchApiSolrEvents; |
This file contains 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 | |
// This file will reside in modules/custom/YOURMODULE/src/Config | |
namespace Drupal\custom_event\Config; | |
use Drupal\Core\Cache\CacheableMetadata; | |
use Drupal\Core\Config\ConfigFactoryOverrideInterface; | |
use Drupal\Core\Config\StorageInterface; | |
/** | |
* Example configuration override. |
This file contains 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
# To see the 10 biggest files, run this from the root directory: | |
$ git verify-pack -v .git/objects/pack/pack-7b03cc896f31b2441f3a791ef760bd28495697e6.idx \ | |
| sort -k 3 -n \ | |
| tail -10 | |
# To see what each file is, run this: | |
$ git rev-list --objects --all | grep [first few chars of the sha1 from previous output] | |
# Rewrite all the commits: | |
$ git filter-branch --index-filter 'git rm --cached --ignore-unmatch "Folder Name/*"' -- --all |
This file contains 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
# use sudo apt-get update command to download package information from all configured sources. | |
# The sources often defined in the /etc/apt/sources. | |
sudo apt update | |
# upgrade google chrome to latest stable version | |
sudo apt --only-upgrade install google-chrome-stable | |
# check the google chrome version | |
google-chrome --version |
This file contains 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
// Git global setup | |
git config --global user.name "your git username" | |
git config --global user.email "your git email address" | |
// Create a new repository | |
git clone <.git url> | |
cd project_folder | |
touch README.md | |
git add README.md | |
git commit -m "add README" |
NewerOlder