Skip to content

Instantly share code, notes, and snippets.

View carlwiedemann's full-sized avatar

Carl Wiedemann carlwiedemann

View GitHub Profile
function findfunc {
grep -rn "function $1(" *| grep -vP "tags|patch$"| awk -F':' '{print $1,$2}' |
while read FILE LINE
do
mvim +${LINE} ${FILE}
done
}
/**
* Implements hook_block_alter().
*/
function bartik_block_alter(&$definitions) {
$definitions['page_primary_links']['class'] = 'Drupal\\bartik\\blocks\\PrimaryLinks';
$definitions['page_secondary_links']['class'] = 'Drupal\\bartik\\blocks\\SecondaryLinks';
}
<?php
namespace Drupal\layout\Plugin\block\block;
use Drupal\block\BlockBase;
use Drupal\Core\Annotation\Plugin;
use Drupal\Core\Annotation\Translation;
/**
* @Plugin(
<?php
namespace Drupal\bartik\blocks;
use Drupal\layout\Plugin\block\block\PagePrimaryLinks;
class PrimaryLinks extends PagePrimaryLinks {
/**
* Implements BlockInterface::build().
@listrophy
listrophy / Custom.css
Created January 3, 2013 15:40
Put this in "~/Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css" to highlight your blocked stories.
.projects_stories_page .storyLabels a[title="blocked"] {
background-color: red;
color: white !important;
padding: 0 3px;
display: inline-block;
}
@jpstroop
jpstroop / c4l_loris_lightning_talk.md
Last active December 12, 2015 12:19
Lightning talk re: Loris <https://github.com/pulibrary/loris> for code4lib 2013.
#!/bin/bash
# Daisydiff script based on https://gist.github.com/c4rl/5385704 for unix users
# Required folder structure:
# - this script
# - daisydiff folder
# - tmp folder
# CONFIGURATION
USERNAME=youruser
@joelpittet
joelpittet / attributes-count
Created May 25, 2013 16:36
List of all the template files uses of attributes, title_attributes and content_attributes in d8
Drupal 8 Stats as of May 24th, 2013
`title_attributes` used in 12 templates or theme functions.
`content_attributes` used in 9 templates or theme functions and assumed existance in rdf.
`attributes` used in 35 templates or theme functions.
## Title Attributes
```
core/modules/block/templates/block.html.twig:
@lewisnyman
lewisnyman / gist:5651296
Created May 26, 2013 00:22
template_preprocess_html
/**
* Prepares variables for HTML document templates.
*
* Default template: html.html.twig.
*
* @param array $variables
* An associative array containing:
* - page: A render element representing the page.
*
* @see system_elements()
<?php
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
register_shutdown_function(function () {
$namespace = 'sitename';
$filename = '/tmp/' . uniqid() . '.' . $namespace . '.xhprof';
file_put_contents($filename, serialize(xhprof_disable()));
});