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
$result = ''; | |
fetch("SELECT title FROM tbl", function($r) use (&$result) { | |
$result .= $r['title']; | |
}); |
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
sudo -u www-data /var/push.sh |
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
sudo mkdir /var/www/.ssh | |
sudo chown -R www-data /var/www/.ssh | |
sudo -u www-data ssh-keygen -t rsa |
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 lfs untrack '<file-type>' | |
git rm --cached '<file-type>' | |
git add '<file-type>' | |
git commit -m "restore '<file-type>' to git from lfs" |
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
drush eval "var_dump(Drupal\Component\Utility\Crypt::randomBytesBase64(55))" |
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
// We can go the long way | |
$field = $group->some_field->first(); | |
// then | |
$reference_entity_id = $field->getValue()['target_id']; | |
// But there is a better way to do it | |
$reference_entity_id = $group->some_field->target_id; | |
// The same way we can extract simple types, like string and integer |
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
for uid in $(drush sqlq "SELECT uid FROM users"); do drush user:login --uid=$uid; done |
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 startupgrowth_preprocess_links__language_block(&$variables) { | |
foreach ($variables['links'] as $i => $link) { | |
/** @var \Drupal\language\Entity\ConfigurableLanguage $linkLanguage */ | |
// $linkLanguage = $link['link']['#options']['language']; | |
// $variables['links'][$i]['link']['#title'] = $linkLanguage->get('id'); | |
$variables['links'][$i]['link']['#title']= $i; | |
} | |
} |
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 | |
phpinfo(); |
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 fut_content_preprocess_field(&$variables) { | |
$element = $variables['element']; | |
if ($element['#field_type'] == 'comment') { | |
if (_fut_content_prevent_comments()) { | |
unset($variables['comment_form']); | |
} | |
} | |
} | |
function fut_content_comment_links_alter(array &$links, CommentInterface $entity, array &$context) { |