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 config --global core.excludesfile ~/.gitignore_global | |
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so |
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
/* | |
* Bootstrap override | |
* make dropdown menus do dropdown on hover, | |
* and allow parent link to be clickable | |
*/ | |
// place this in your styles | |
ul.nav li.dropdown:hover > ul.dropdown-menu{ | |
display: block !important; | |
} |
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
cd repository | |
git checkout --orphan orphan_name | |
git rm -rf . | |
rm '.gitignore' | |
echo "#Title of Readme" > README.md | |
git add README.md | |
git commit -a -m "Initial Commit" | |
git push origin orphan_name |
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
# This is a general-purpose function to ask Yes/No questions in Bash, either | |
# with or without a default answer. It keeps repeating the question until it | |
# gets a valid answer. | |
ask() { | |
# https://djm.me/ask | |
local prompt default reply | |
if [ "${2:-}" = "Y" ]; then | |
prompt="Y/n" |
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 | |
// Autoload Url and Link classes. | |
use Drupal\Core\Url; | |
use Drupal\Core\Link; | |
/** | |
* External link | |
*/ | |
$url = Url::fromUri('https://colorfield.be'); |
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 | |
namespace Drupal\my_module\Services; | |
use Drupal\Core\Config\ConfigFactory; | |
/** | |
* Class MyService. | |
* | |
* @package Drupal\my_module\Services |
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
Including a link: | |
$link = Link::fromTextAndUrl($this->t('Bootstrap Documentation'), Url::fromUri('https://getbootstrap.com/docs/3.4/css/#grid-example-mixed-complete', ['attributes' => ['target' => '_blank']]))->toString(); | |
'#description' => $this->t('When this option is selected, clearfix divs will be used to "clear" the columns as needed per device size (see %bootstrap_docs). Please note this option applies only when "Single row" is selected for the "Number of columns per view row" option.', | |
['%bootstrap_docs' => $link]), | |
The most common placeholder is probably @variable. This placeholder runs static::placeholderEscape() on the text before replacing it. | |
You may also use %variable, which runs placeholderEscape() on the text similar to @ placeholders. Using this placeholder will also create <em> tags around the placeholder values. |
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 | |
/** | |
* @file | |
* Token related hook implementations. | |
*/ | |
use Drupal\Core\Render\BubbleableMetadata; | |
/** |
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 | |
/** | |
* @file | |
* Contains various helper functions. | |
*/ | |
use Drupal\taxonomy\Entity\Term; | |
/** |
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 | |
// Load a Node | |
use Drupal\node\Entity\Node; | |
$node = Node::load($nid); | |
// Load Multiple Nodes | |
use Drupal\node\Entity\Node; | |
$nodes = Node::loadMultiple($nids); |
OlderNewer