Skip to content

Instantly share code, notes, and snippets.

@jrbeeman
jrbeeman / drupal-8.4.x-SA005.patch
Created August 2, 2018 00:47
Drupal 8.4.x patch for SA-CORE-2018-005
diff --git a/core/composer.json b/core/composer.json
index 307aefa31d..bb9d0f2736 100644
--- a/core/composer.json
+++ b/core/composer.json
@@ -5,31 +5,31 @@
"license": "GPL-2.0-or-later",
"require": {
"php": ">=5.5.9",
- "symfony/class-loader": "~3.2.8",
- "symfony/console": "~3.2.8",
@jrbeeman
jrbeeman / wc_share.module
Created June 24, 2014 20:14
Example of simple custom sharing widget module in Drupal
<?php
/**
* @file
* Watercooler: Share module.
*
* Twitter widget generated at: https://about.twitter.com/resources/buttons#tweet
* Facebook widget generated at: https://developers.facebook.com/docs/plugins/like-button/
* Google+ widget generated at: https://developers.google.com/+/web/+1button/
*
@jrbeeman
jrbeeman / .gitconfig
Created November 1, 2013 22:16
My .gitconfig
[core]
excludesfile = /Users/jbeeman/.gitignore_global
editor = subl -n -w
[diff]
tool = vimdiff
memonicprefix = true
[difftool]
prompt = false
@jrbeeman
jrbeeman / gist:4263048
Created December 11, 2012 22:46
Deny access to view Metatag tokens until we can get token memory consumption under control. For example, in a client project site, this trimmed ~40mb off of PHP memory required to render the node/add/article page and took the total HTML payload from 7.18mb to 43.68kb on another content type. Related Drupal.org issues: <http://drupal.org/node/105…
<?php
/**
* Implements hook_form_alter().
*/
function mymodule_form_alter(&$form, &$form_state, $form_id) {
if (!empty($form['#node_edit_form']) && !empty($form['metatags'])) {
$form['metatags']['tokens']['#access'] = FALSE;
}
if ($form_id == 'flag_form') {
@jrbeeman
jrbeeman / feeds-bulk-import.php
Created April 13, 2012 02:12
drupal feeds bulk import
#!/usr/bin/php
<?php
/**
* Utility a script that will loop through feed nodes of a given importer and,
* in a performant way, re-import them all.
*
* Usage: feeds-bulk-import @site-alias importer_name
*/
@jrbeeman
jrbeeman / metatags-memory-fix.php
Created March 24, 2012 17:20
Don't allow token reference with metatag module to destroy node/add pages
<?php
/**
* Implements hook_form_alter().
*/
function hook_form_alter(&$form, &$form_state, $form_id) {
// Deny access to view Metatag tokens if token memory consumption is out of
// control. In one site build, this trimmed ~40mb off of memory required to
// render the node/add page for a custom article page and took the total HTML
// payload on another content type's node/add page from 7.18mb to 43.68kb.
@jrbeeman
jrbeeman / gist:1443446
Created December 7, 2011 16:24
My .emacs config, including a modified drupal-mode
This is out of date. See https://github.com/jrbeeman/emacs.d
@jrbeeman
jrbeeman / gist:1118052
Created August 1, 2011 12:42
Find duplicate URL aliases in Drupal
SELECT alias, COUNT(pid) AS total FROM url_alias GROUP BY alias HAVING COUNT(pid) > 1 ORDER BY total ASC;
<?php
// myrep.php -- automated MySQL repairer
//
// Modified by Jeff Beeman, October, 2010
// -- Added table optimization
// -- Reformatted code syntax
//
// Original:
// (C) Copyright 2008 David Cutting
// Released under the GNU GPL v3