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
#!/usr/bin/env bash | |
#: exec_target = cli | |
# PROJECT_ROOT and DOCROOT are set as env variables in cli | |
SITE_DIRECTORY="default" | |
DOCROOT_PATH="${PROJECT_ROOT}/${DOCROOT}" | |
SITEDIR_PATH="${DOCROOT_PATH}/sites/${SITE_DIRECTORY}" | |
mysql --user="$MYSQL_USER" --database="$MYSQL_DATABASE" --password="$MYSQL_PASSWORD" -e "SHOW TABLES LIKE 'cache%'" | tail -n +2 | xargs -L1 -I% echo "TRUNCATE TABLE %;" > cache-tables.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
alias fuli='open $(fin uli)' |
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 's/utprof_/pharm_/' * | |
# For OS X, GNU rename can be installed using homebrew: brew install rename. |
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
# Detect whether the current directory is a git repository. | |
function is_git_repository { | |
git branch > /dev/null 2>&1 | |
} | |
function parse_git_dirty { | |
[[ -z $(git status --porcelain) ]] || echo "*" | |
} | |
function parse_git_branch { | |
# Set the BRANCH variable. |
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
SELECT `title`, COUNT(`title`) FROM `node_field_data` GROUP BY `title` HAVING COUNT(`title`) > 1 | |
// https://www.sqlservertutorial.net/sql-server-basics/sql-server-find-duplicates |
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 | |
$input = 'Some text<a href="#">Test</a><ul class="accordion" data-accordion role="tablist"> | |
<li class="accordion-navigation" role="presentation"> | |
<a href="#panel1d" role="tab" id="panel1d-heading" aria-controls="panel1d">Accordion 1</a> | |
<div id="panel1d" class="content active" role="tabpanel" aria-labelledby="panel1d-heading"> | |
Panel 1. Lorem ipsum dolor | |
</div> | |
</li> | |
<li class="accordion-navigation" role="presentation"> |
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\mymodule\Enhancer; | |
use Drupal\Core\Routing\EnhancerInterface; | |
use Drupal\taxonomy\TermInterface; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\Routing\Route; | |
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 | |
namespace Drupal\mymodule; | |
use Drupal\layout_builder\Section; | |
/** | |
* Resave inline blocks associated with cloned nodes. | |
*/ | |
class Defuser { |
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 | |
// @codingStandardsIgnoreFile | |
// NOTE: THIS CAN BE ACHIEVED WITH drupal/backward_compatibility | |
function find_info_files($dir) { | |
$root = scandir($dir); | |
$result = []; | |
foreach ($root as $value) { | |
if ($value === '.' || $value === '..') { | |
continue; |