Skip to content

Instantly share code, notes, and snippets.

@Greg-Boggs
Greg-Boggs / wordpress.vcl
Last active June 19, 2021 01:31 — forked from matthewjackowski/wordpress.vcl
Varnish 4 VCL configuration for WordPress. Also allows purging
#
# This is an example VCL file for Varnish.
#
# It does not do anything by default, delegating control to the
# builtin VCL. The builtin VCL is called when there is no explicit
# return statement.
#
# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
# and http://varnish-cache.org/trac/wiki/VCLExamples for more examples.
@Greg-Boggs
Greg-Boggs / RoboFile.php
Created January 28, 2016 17:03 — forked from wxactly/RoboFile.php
ThinkShout/Cascade RoboFile
<?php
/**
* This is project's console commands configuration for Robo task runner. fork
*
* @see http://robo.li/
*/
class RoboFile extends \Robo\Tasks
{
/**
* Run Drupal tests.
<?php
// Inside form alter function insert validation using buttons like commerce does.
// Insert the validation at the beginning of the array so the commerce module
// can access any of our errors and place them in the correct block instead of at top of page.
array_unshift($form['buttons']['continue']['#validate'], 'treepeople_commerce2_organization_validate');
// Inside the validate function, set the errors using a special concatenated field name
// that include the panel the field is in. Notice there are no outer brackets.
form_set_error('customer_profile_billing][field_organization_name', t('Company/Organization Name field is required.'));
@Greg-Boggs
Greg-Boggs / Php56 install homebrew mac drupal
Last active April 13, 2018 20:47 — forked from nrackleff/drupal-56-upgrade
Install Php56 with Drupal configs on Mac with Homebrew with xedebug and OPcache
Steps to update local dev environment to PHP5.6 to be ready for Drupal 8.
In a terminal window:
brew update ( you may also may need brew doctor)
brew unlink php55
brew install php56 --with-homebrew-apxs --with-apache
brew install php56-xdebug
diff --git a/sites/default/settings.php b/sites/default/settings.php
index b2ce930..9d0514e 100644
--- a/sites/default/settings.php
+++ b/sites/default/settings.php
@@ -611,7 +611,8 @@
* The 'bootstrap_config_storage' setting needs to be a callable that returns
* core.services.yml.
*/
- # $settings['bootstrap_config_storage'] = array('Drupal\Core\Config\BootstrapConfigStorageFactory', 'getFileStorage');
+$settings['bootstrap_config_storage'] = 'Drupal\Core\Config\BootstrapConfigStorageFactory::getFileStorage';
@Greg-Boggs
Greg-Boggs / config-dev.patch
Last active August 29, 2015 14:10 — forked from sun/config-dev.patch
This patch for Drupal 8 will enable the much anticipated CMI Config in Code... I think.
diff --git a/sites/default/settings.php b/sites/default/settings.php
index b2ce930..9d0514e 100644
--- a/sites/default/settings.php
+++ b/sites/default/settings.php
@@ -611,7 +611,8 @@
* The 'bootstrap_config_storage' setting needs to be a callable that returns
* core.services.yml.
*/
- # $settings['bootstrap_config_storage'] = array('Drupal\Core\Config\BootstrapConfigStorageFactory', 'getFileStorage');
+$settings['bootstrap_config_storage'] = 'Drupal\Core\Config\BootstrapConfigStorageFactory::getFileStorage';
@Greg-Boggs
Greg-Boggs / template.php
Last active August 29, 2015 14:09 — forked from anonymous/gist:eda2facf47642acc2446
Alter a campaign monitor form to include honey pot.
<?php
function tng_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'campaignmonitor-subscribe-form') {
honeypot_add_form_protection($form, $form_state, array('honeypot', 'time_restriction'));
}
}
#!/bin/bash
# Script to install Drupal app
# Be careful using database credentials, this script is meant to be used on development server, to speed things up.
dbuser="root"
dbpass="root"
sites_path="~/Sites"
if [ $# -lt 1 ];
<?php
function web2theme_preprocess_user_profile(&$variables) {
if( arg(2)==null ) { //im not editing
$qty_field=count($variables['user_profile']['field_telefone']['#items']);
for($i=0 ; $i<$qty_field; $i++) {
$field_collection_id = $variables['field_telefone'][$i]['value'];
//dsm($variables['user_profile']['field_telefone'][$i]['entity']['field_collection_item'][$field_collection_id]['field_telefone_showed']);
$toshow = $variables['user_profile']['field_telefone'][$i]['entity']['field_collection_item'][$field_collection_id]['field_telefone_showed'];
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>