Skip to content

Instantly share code, notes, and snippets.

@Quilted
Quilted / README.md
Last active December 12, 2015 01:38
Drupal 7: Setting up bulk WordPress to Drupal migration redirects

Drupal 7: Setting up bulk WordPress to Drupal migration redirects

When would I use this?

If you have a database of WordPress URLs that need to be redirected in Drupal 7.

What do I do?

  1. Install Redirect module.
  2. Install path_redirect_import module.
#!/usr/bin/env sh
brew update
brew install rbenv
brew install ruby-build
brew install openssl
RUBY_CONFIGURE_OPTS=--with-openssl-dir=`brew --prefix openssl`
rbenv install 2.0.0-preview1
@Quilted
Quilted / gist:7487840
Created November 15, 2013 17:04
Drupal 7 dates with proper timezone handling
<?php
// Assumes date field is $variables['field_event_date']
$dateObj = new DateObject($variables['field_event_date'][0]['value'], new DateTimeZone($variables['field_event_date'][0]['timezone_db']));
$dateObj->setTimezone(new DateTimeZone($variables['field_event_date'][0]['timezone']));
$date = $dateObj->getTimestamp();
@Quilted
Quilted / Drupal7.php
Created January 17, 2014 02:46
Behat: Support taxonomy term entity references when creating new nodes during testing. Edit vender/drupal/drupalextension/src/Drupal/Driver/Core/Drupal7.php in function exandEntityFields().
// Special handling for entity references.
elseif ('entityreference' === $info['module']) {
$values = explode(',', $value);
// Handle taxonomy terms.
// @todo generalize.
if ($info['settings']['target_type'] == 'taxonomy_term') {
$i = 0;
foreach ($values as $tid) {
$new_entity->{$param}[LANGUAGE_NONE][$i]['target_id'] = $tid;
@Quilted
Quilted / gist:8480580
Last active January 3, 2016 15:09
Turn on Jenkins and Selenium
@Quilted
Quilted / html.preprocess.inc
Created January 28, 2014 22:48
Sticky footer JS and Omega theme code
<?php
// Load the matchMedia polyfill.
if (module_exists('picture') && drupal_get_library('picture', 'matchmedia')) {
$options = array('group' => 'globalgamejam_theme');
// Load the mediaquery behavior from Omega. This allows registering media
// queries via Drupal.settings to automatically print body classes based on
// whether or not they currently apply.
$omega = drupal_get_path('theme', 'omega');
@Quilted
Quilted / gist:8745428
Last active August 29, 2015 13:55
Install Jenkins on OSX
@Quilted
Quilted / _1_sticky_footer.scss
Last active November 1, 2017 20:14
Omega 4 media query and breakpoints files
@Quilted
Quilted / howtobehat.md
Last active April 21, 2018 10:52
How to setup Drupal extension for Behat

Set up Behat testing for Drupal

(1) Create a tests folder. Perform the following install tasks within that folder unless otherwise specified.

(2) Follow directions to install the Behat Drupal extension.

(3) Add the following lines to the main repo .gitignore:

# Ignore behat files that can be easily initialized

tests/bin