This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name drupal.org Recent comments | |
// @namespace https://github.com/mootari/ | |
// @version 0.1 | |
// @description Shows recent comments on a user's profile page | |
// @include /^https:\/\/www\.drupal\.org\/u\/[^\/]+$ | |
// ==/UserScript== | |
(function($) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_module_implements_alter(). | |
* | |
* Ensures that special_menu_items doesn't override menu_minipanels' | |
* theme_registry_alter implementation. | |
*/ | |
function MODULE_module_implements_alter(&$implementations, $hook) { | |
if($hook === 'theme_registry_alter' && isset($implementations['special_menu_items']) && isset($implementations['menu_minipanels'])) { | |
$value = $implementations['menu_minipanels']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_scald_contexts(). | |
* | |
* Automatically creates and owns scald contexts from exported image styles. | |
*/ | |
function MODULE_scald_contexts() { | |
$func = 'FEATURE_image_default_styles'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function MODULE_my_form($form, &$form_state) { | |
// ... | |
$form['#pre_render'][] = 'MODULE_my_form_add_table'; | |
return $form; | |
} | |
function MODULE_my_form_add_table($form) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function MODULE_form_node_form_after_build($form) { | |
$menu_form = &$form['menu']; | |
$menu_form = MODULE_node_form_reformat_menus($menu_form); | |
} | |
/** | |
* Reformats parent menu selects. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function drupal_debug_schema($module, $table) { | |
$schema = drupal_get_schema_unprocessed($module); | |
_drupal_schema_initialize($schema, $module, false); | |
$dbSchema = Database::getConnection()->schema(); | |
$refMethod = new ReflectionMethod($dbSchema, 'createTableSql'); | |
$refMethod->setAccessible(true); | |
return $refMethod->invoke($dbSchema, $table, $schema[$table]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function MODULE_form_NODE_TYPE_node_form_alter(&$form, &$form_state, $form_id) { | |
$prefix = 'PREFIX/'; | |
if(isset($form['path']['alias'])) { | |
$element = &$form['path']['alias']; | |
$element['#default_value'] = preg_replace('#^' . preg_quote($prefix) . '#', '', $element['#default_value']); | |
$element['#field_prefix'] = $prefix; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT u.uid user_uid, w.uid admin_uid | |
FROM watchdog w, users u | |
WHERE w.type = 'user' | |
AND w.message LIKE 'New user:%' | |
AND w.variables REGEXP CONCAT('^a:2:{s:5:"%name";s:[0-9]+:"', u.name, '";'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.14) | |
// Compass (v1.0.3) | |
// ---- | |
$sel-1: (h2, ".fs-h2"); | |
$sel-2: (p, ol, ul); | |
$extend: unique-id(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_plugin_track_shortcode($name, &$flag) { | |
global $shortcode_tags; | |
if(!isset($shortcode_tags[$name])) { | |
return false; | |
} | |
$callback = $shortcode_tags[$name]; | |
$shortcode_tags[$name] = function() use($name, &$flag, $callback) { | |
$args = func_get_args(); |