Skip to content

Instantly share code, notes, and snippets.

Frederick Henderson frederickjh

Block or report user

Report or block frederickjh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@frederickjh
frederickjh / RoboConfig.php
Created Mar 16, 2018
Robo task runner backup Task and configuration files for Drupal 8, Drush 9 with a composer based workflow.
View RoboConfig.php
<?php
#### Configuration for MEOS Drupal 8 Backups with RoboFile
## Site URI
$siteuri='example.com';
## Folder where you want backups to be stored remotely. No trailing slashes!
$remotebackupbasepath='/home/user/backups/squidixvps';
## Remote backup user and server in the form of user@server
@frederickjh
frederickjh / hashsalt.fish
Created Mar 5, 2018
Fish shell function for generating hash_salt in a file for use with Drupal 8 websites.
View hashsalt.fish
function hashsalt --description 'Generate Drupal 8 hash salt in the current directory in the file, hash_salt.txt. Best to generate in composer project root and ignore in .gitignore. To use this file in settings.php use a line like: $settings[\'hash_salt\'] = file_get_contents(\'../hash_salt.txt\');'
drush eval "print_r(Drupal\Component\Utility\Crypt::randomBytesBase64(55))" > hash_salt.txt
echo 'hash_salt.txt has been generated. Best to generate in composer project root and ignore in .gitignore. To use this file in settings.php use a line like: $settings[\'hash_salt\'] = file_get_contents(\'../hash_salt.txt\');'
end
@frederickjh
frederickjh / themename.theme
Created Jul 3, 2017
This the code is from the "DrupalCon Baltimore 2017: Demystifying Rendered Content in Drupal 8 Twig Files" presentation by Amy Vaillancourt-Sals slide 30 "Create a custom file name suggestion". It adds Twig templates for block bundles.
View themename.theme
/**
* This code is from the "DrupalCon Baltimore 2017: Demystifying Rendered Content in Drupal 8 Twig Files" presentation by Amy Vaillancourt-Sals slide 30 "Create a custom file name suggestion".
* Video: https://www.youtube.com/watch?v=qoeRpRkGwmk
* Slides: https://drive.google.com/file/d/0B8g8dQw8nc9eV3U4SjZKNWNEWGM/view?usp=sharing
* Drupalcon Baltimore Session: https://events.drupal.org/baltimore2017/sessions/demystifying-rendered-content-drupal-8-twig-files
* This code adds Twig templates for block bundles. Replace "themename" below with your theme's machine name.
* Implements hook_theme_suggestions_HOOK_alter() for templates.
* @param array $suggestions
* @param array $variables
*/
@frederickjh
frederickjh / bad-behavior.make.yml
Created Aug 22, 2016
make file to install bad-behavior module and library
View bad-behavior.make.yml
api: '2'
core: 7.x
# Specify common subdir of "contrib"
defaults:
projects:
subdir: "contrib"
libraries:
bad-behavior:
download:
type: "file"
@frederickjh
frederickjh / .htaccess
Last active Oct 20, 2017 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
View .htaccess
How to force HTTPS using the .htaccess file
To force all web traffic to use HTTPS insert the following lines of code in the .htaccess file in your website’s root folder.
Important:If you have existing code in your .htaccess, add this above where there are already rules with a similar starting
prefix.
# Redirect to SSL version of a site without needing to set the domain name,
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
@frederickjh
frederickjh / install_fish_shell_locally.sh
Last active Aug 16, 2018 — forked from eugenesvk/fish_shell_local_install.sh
Installs Fish Shell without root access
View install_fish_shell_locally.sh
#! /bin/bash
# Bash script for installing Fish Shell on systems without root access
# Fish Shell will be installed in $HOME/local/bin
# It's assumed that wget and a C/C++ compiler are installed
set -e # exit on error
FISH_VER=2.2.0
mkdir -p $HOME/local $HOME/fish_shell_tmp # create our directories
cd $HOME/fish_shell_tmp
@frederickjh
frederickjh / tailor_your_backend_to_the_clients_needs-move_the_moderation_state_to_the_actions_region.php
Created Mar 17, 2015
Code from slide 49 of "Tailor your backend to meet the clients needs" - move the moderation state to the actions region
View tailor_your_backend_to_the_clients_needs-move_the_moderation_state_to_the_actions_region.php
<?php
/** Text from slide 49 of "Tailor your backend to meet the clients needs"
* http://www.slideshare.net/stevenvdhout/durable-drupal-backend
* move the moderation state to the actions region
**/
$form['revision_information']['#collapsed'] = TRUE;
if (isset($form['revision_information']['workbench_moderation_state_new'])) {
$form['actions']['workbench_moderation_state_new'] = $form['revision_information']['workbench_moderation_state_new'];
unset($form['revision_information']['workbench_moderation_state_new']);
}
@frederickjh
frederickjh / tailor_your_backend_to_the_clients_needs-improve_the_url_selction_form.php
Created Mar 17, 2015
Code from slide 47 of "Tailor your backend to meet the clients needs" - Improve the URL selection form
View tailor_your_backend_to_the_clients_needs-improve_the_url_selction_form.php
<?php
/** Text from slide 47 of "Tailor your backend to meet the clients needs"
* http://www.slideshare.net/stevenvdhout/durable-drupal-backend
* Improve the URL selection form
**/
if (isset($form['#entity_type'])
&& $form['#entity_type'] == 'node'
&& isset($form['path'])
&& isset($form['path']['alias'])) {
unset($form['path']['#type']); // remove the fieldset
@frederickjh
frederickjh / tailor_your_backend_to_the_clients_needs-remove_items_from_vertial_tabs_and_add_to_another_fieldset.php
Created Mar 17, 2015
Code from slide 45 of "Tailor your backend to meet the clients needs" - remove items from vertical tabs, and add them to another fieldset
View tailor_your_backend_to_the_clients_needs-remove_items_from_vertial_tabs_and_add_to_another_fieldset.php
<?php
/** Text from slide 45 of "Tailor your backend to meet the clients needs"
* http://www.slideshare.net/stevenvdhout/durable-drupal-backend
* remove items from vertical tabs, and add them to another fieldset
**/
if (isset($form['#groups']['group_settings'])) {
$weight = 0;
foreach ($form as $key => $value) {
if(is_array($value) && isset($value['#group'])) {
unset($form[$key]['#group']);
You can’t perform that action at this time.