Skip to content

Instantly share code, notes, and snippets.

View larowlan's full-sized avatar
:shipit:
Framework Manager, Drupal Core

Lee Rowlands larowlan

:shipit:
Framework Manager, Drupal Core
View GitHub Profile
<?php
/**
* @file
* Contains \Drupal\system\Plugin\Block\SystemBrandingBlock.
*/
namespace Drupal\system\Plugin\Block;
use Drupal\block\BlockBase;
<?php
namespace Foo\Bar\Whistle;
use Drupal\Core\RequestInfo;
class Sniffer {
public function getMine($request) {
$raw = RequestInfo::getRawVariables($request);
$test = array(
'settings' => array(
'foo' => (object) array(
'value' => TRUE,
),
),
'expected' => '$foo = TRUE;"
);
@larowlan
larowlan / git-cleanup.sh
Created April 15, 2014 19:54
Git Cleanup
#!/bin/bash
# This has to be run from master
git checkout master
# Update our list of remotes
git fetch
# Prune stale local branches already removed from origin
git remote prune origin
# Remove local fully merged branches
/**
* Set the summary to a trimmed version of the body.
*
* @param object $node
* A node object.
* @param \stdClass $row
* The source row.
*/
public function prepare($node, \stdClass $row) {
$node->body[LANGUAGE_NONE][0]['summary'] = text_summary($node->body[LANGUAGE_NONE][0]['value'], 'filtered_html', 150);
drush.source="@aifs.dev"
app.uri="http://aifs.dev"
@larowlan
larowlan / drushrc.php
Created May 19, 2014 02:44
drushrc.php to exclude cache tables
<?php
$options['structure-tables']['cache'] = array('queue', 'cache', 'cache_form', 'cache', 'cache_apachesolr', 'cache_block', 'cache_bootstrap', 'cache_entity_comment', 'cache_entity_file', 'cache_entity_node', 'cache_entity_taxonomy_term', 'cache_entity_taxonomy_vocabulary', 'cache_entity_user', 'cache_field', 'cache_filter', 'cache_form', 'cache_image', 'cache_libraries', 'cache_media_xml', 'cache_menu', 'cache_metatag', 'cache_page', 'cache_path', 'cache_rules', 'cache_token', 'cache_update', 'cache_views', 'cache_views_data', 'ctools_css_cache', 'ctools_object_cache');
id: d6_comment_type
label: Drupal 6 comment type
source:
plugin: variable
variables:
- site_name
constants:
entity_type: node
id: comment
label: comment
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/MinkNodeElementDecorator.php b/core/modules/simpletest/lib/Dr
index d249503..3363fb9 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/MinkNodeElementDecorator.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/MinkNodeElementDecorator.php
@@ -9,14 +9,19 @@
use Behat\Mink\Element\NodeElement;
-class MinkNodeElementDecorator implements \ArrayAccess {
+class MinkNodeElementDecorator implements \ArrayAccess, \Iterator {
# Remove existing database
drush6 sql-drop -y;
# Remove existing install
sudo rm -rf sites/default;
# Restore the sites/default/default.settings.php file
sudo git checkout -- sites/default;
# Temporarily make the sites/default writable by anyone
sudo chmod -R 777 sites/default;
# Ensure the owner is the current user, not root user
sudo chown -R `whoami` sites/default;