Skip to content

Instantly share code, notes, and snippets.

View anthonyringoet's full-sized avatar

Anthony R anthonyringoet

View GitHub Profile
@anthonyringoet
anthonyringoet / template.php
Created November 28, 2011 07:55 — forked from jacine/template.php
Bye, bye region.tpl.php and block--system--main.tpl.php
<?php
/**
* Implements hook_page_alter().
*/
function mytheme_page_alter(&$page) {
// Remove all the region wrappers.
foreach (element_children($page) as $key => $region) {
if (!empty($page[$region]['#theme_wrappers'])) {
$page[$region]['#theme_wrappers'] = array_diff($page[$region]['#theme_wrappers'], array('region'));
@anthonyringoet
anthonyringoet / gist:1433078
Created December 5, 2011 09:57
add modernizr in template.php and avoid it gets preprocessed
<?php
function hook_preprocess_html(&$vars) {
// add modernizr and avoid that it gets preprocessed
$options = array('preprocess' => FALSE,
'weight' => -25.000,
'group' => -100);
drupal_add_js('/sites/all/libraries/modernizr/modernizr.min.js', $options);
}
?>
!!! 5
/[if lt IE 7] <html lang="en" class="no-js ie6">
/[if IE 7 ] <html lang="en" class="no-js ie7">
/[if IE 8 ] <html lang="en" class="no-js ie8">
/[if IE 9 ] <html lang="en" class="no-js ie9">
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
%head
%meta{ "charset" => "utf-8" }/
= csrf_meta_tag
%meta{ "http-equiv" => "X-UA-Compatible", :content => "IE=edge,chrome=1" }/
@anthonyringoet
anthonyringoet / dabblet.css
Created January 25, 2012 09:20
html5 progress bar styling
/**
* html5 progress bar styling
*/
html{
background: #f06;
background: linear-gradient(45deg, #f33, #a33);
min-height:100%;
}
/* remove standard styling
@anthonyringoet
anthonyringoet / gist:1853495
Created February 17, 2012 13:40
Drupal language block with only prefixes + modification for no result
<?php
/**
* Override the output of the default locale language switch links.
* We only want prefixes. If no link available, go to frontpage. Better than nothing.
*/
function theme_links__locale_block(&$variables) {
$links = $variables['links'];
$attributes = $variables['attributes'];
$heading = $variables['heading'];
global $language_url;
@anthonyringoet
anthonyringoet / template.php
Created April 3, 2012 08:20
Remove contextual links when using Semantic Views to cleanup view rows - drupal
<?php
/**
* Implements template_preprocess_views_view
* if we're using Semantic Views to remove all the rows,
* things can get messy with nth-child selectors in css because
* of the dirty contextual links in the title_suffix.
* Remove them automatically when using Semantic Views and stripping out row markup.
*/
function YOURTHEME_preprocess_views_view(&$vars) {
$view = $vars['view'];
@anthonyringoet
anthonyringoet / remove-classes.php
Created April 3, 2012 09:49
Remove classes in drupal
<?php
// throw out unnecesary classes
$vars['classes_array'] = array_diff($vars['classes_array'], array('toRemove1', 'toRemove2'));
@anthonyringoet
anthonyringoet / panels-twocol-bricks.tpl.php
Created April 4, 2012 09:54
cleanup panels-twocol-bricks.tpl.php markup
<?php
/**
* cleanup this mess by checking if something exists before printing all the markup surrounding it.
*/
?>
<div class="panel-display panel-2col-bricks " <?php if (isset($css_id)) { print "id=\"$css_id\""; } ?>>
<?php if(!empty($content['top'])): ?>
<div class="panel-panel panel-col-top">
<?php print $content['top']; ?>
</div>
@anthonyringoet
anthonyringoet / fout.scss
Created April 11, 2012 15:30
flash of unstyled text mixin
// include this after you declare your webfont
@mixin fout{
.wf-loading &,
.wf-inactive &{
visibility:hidden;
}
.wf-active &{
visibility:visible;
}
}
@anthonyringoet
anthonyringoet / template.php
Created April 16, 2012 12:12
aggregate drupal css and js in ONE file each, not one file per group
<?php
function hook_js_alter(&$js){
uasort($js, 'drupal_sort_css_js');
$i = 0;
foreach($js as $name => $script) {
$js[$name]['weight'] = $i++;
$js[$name]['group'] = JS_DEFAULT;
$js[$name]['every_page'] = FALSE;
$js[$name]['scope'] = 'footer';