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
constructor() { | |
this.el = document; | |
this.evt = (e) => { | |
... | |
} | |
} | |
// Trigger exclusion modal if a click happens anywhere except on the modal box | |
this.el.addEventListener('click', this.evt); | |
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
$ find / -type f -name MYFILE.TXT |
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
$ echo "<?php phpinfo(); ?>" | php | pbcopy |
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 archive -o archive.zip HEAD $(git diff --name-only <commit_hash> <commit_hash>) |
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
function getNodeAliases($langcode = 'en') { | |
$aliases = []; | |
$nids = \Drupal::entityQuery('node') | |
->condition('status', 1) // published | |
->condition('langcode', $langcode) | |
->execute(); | |
foreach ($nids as $nid) { | |
$system_path = '/node/' . $nid; | |
$path_alias = db_query("SELECT alias FROM {url_alias} WHERE source = '$system_path' AND langcode = '{$langcode}'")->fetchField(); | |
$aliases[] = $path_alias; |
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
\Drupal::service("router.builder")->rebuild(); |
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
// Ordered by execution speed | |
$ext = pathinfo($filename, PATHINFO_EXTENSION); | |
$ext = substr(strrchr($filename, '.'), 1); | |
$ext = substr($filename, strrpos($filename, '.') + 1); | |
$ext = preg_replace('/^.*\.([^.]+)$/D', '$1', $filename); |
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
function getNodeContent( $id, $lang = '' ) { | |
$lang = $lang ?: \Drupal::languageManager()->getCurrentLanguage()->getId(); | |
$node = \Drupal::entityTypeManager() | |
->getStorage('node') | |
->load($id); | |
$translated_node = $node->getTranslation($lang); | |
return [$node, $translated_node]; | |
} |
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
{ | |
"directory" : "app/vendors" | |
} |
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
try { | |
\Drupal::entityDefinitionUpdateManager()->applyUpdates(); | |
} | |
catch (EntityStorageException $e) { | |
print_r($e); | |
} |
NewerOlder