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
var condition = FALSE; | |
if (!condition) { | |
var name = "test" | |
} | |
console.log(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
<?php | |
function csvToArray($string $path, boolean $removeHeader = true) : array { | |
$realPath = drupal_realpath($path); | |
// CSV to array | |
$csvRows = array_map('str_getcsv', file($realPath)); | |
if ($removeHeader) { | |
// Remove header row | |
unset($csvRows[0]); | |
} |
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
# fetch the changes from the remote | |
git fetch origin | |
# show commit logs of changes | |
git log master..origin/master | |
# show diffs of changes | |
git diff master..origin/master | |
# apply the changes by merge.. |
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
/** | |
* Implements hook_page_attachments_alter(). | |
* | |
* Removes the "Generator" tag from the <head>. | |
* This needs to be in the theme despite it being a hook. | |
*/ | |
function themename_page_attachments_alter(array &$page) { | |
$html_head =& $page['#attached']['html_head']; | |
// Get the index for the "Generator" tag. | |
$system_meta_generator_index = array_search('system_meta_generator', array_column($html_head, 1)); |
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; | |
use Drupal\Core\Language\LanguageInterface; | |
use Drupal\Core\Language\LanguageManagerInterface; | |
use Drupal\Core\Path\AliasStorageInterface; | |
class FallbackAliasStorage implements AliasStorageInterface { |
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 | |
// Made on request from a user on drupal slack. | |
// Not fully tested - I've stripped this from a module I made from a client and not tested it still works after | |
// removing some functionality specific to that site. | |
// *Should work* and be a good starting point at least. | |
// Put this in a custom module - The example I took this from was called webfrom_extras. | |
// This may need minor modification - I've scrubbed data from it. |
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\Logger\LoggerChannelFactory; | |
/** | |
* Class MyService. | |
* | |
* @package Drupal\my_module\Services |