Skip to content

Instantly share code, notes, and snippets.

@Greg-Boggs
Greg-Boggs / theme test page
Created September 3, 2013 22:01
Theme Test Page.
<div id="headers">
<h2>Headers</h2>
<p>Headers are used to describe such elements as website name, slogan, section titles. HTML and XHTML specifications define 6 levels of headers, where h1 is the most important and h6 is the least important.</p>
<h1>Header 1 - This is a really really really long header to see how it looks when it wraps. Testing themes is really challenging. Hopefully this is useful.</h1>
<h2>Header 2 - This is a really really really long header to see how it looks when it wraps. Testing themes is really challenging. Hopefully this is useful.</h2>
<h3>Header 3 - This is a really really really long header to see how it looks when it wraps. Testing themes is really challenging. Hopefully this is useful.</h3>
@Greg-Boggs
Greg-Boggs / gist:6467483
Last active December 22, 2015 11:39
Blockforms code to save the current page NID to a entityreference field in the embedded form.
<?php
/**
* Implements node_presave to attach the current node's nid as an entity reference in the node being saved in a block form.
* This code requires 'journal_entry' form to be embedded on a 'course' with the formblock module and the journal_entry type must
* have an entity reference field called 'field_course_reference'
*/
function ucg_node_presave($node) {
$journal_wrapper = entity_metadata_wrapper('node', $node);
if($journal_wrapper->getBundle() == 'journal_entry') {
<?php
elseif ($image_link) {
if (isset($entity->$image_link)) {
// Support for field translations.
$language = field_language($entity_type, $entity, $field['field_name']);
$link_field = $entity->$image_link;
if (isset($link_field[$language])) {
$link_values = $link_field[$language];
}
),
-
),
-
'node-course-field_link' => array(
-
'bundle' => 'course',
@Greg-Boggs
Greg-Boggs / gist:6611390
Last active December 23, 2015 08:59
Responsive Views with Aurora/Singularity and Views Responsive Grid
.views-responsive-grid-vertical {
.views-column-1 {
@include grid-span(4, 1);
@include breakpoint($mobile) {
@include float-span(12, 'first');
}
}
.views-column-2 {
@include grid-span(4, 5);
@include breakpoint($mobile) {
@Greg-Boggs
Greg-Boggs / gist:6640902
Last active December 23, 2015 13:19
Drupal Panels + Display Suite + Clean Markup output
<div class="field field-name-title">
<h2>Basic Panel</h2>
</div>
<div class="field field-name-field-image">
<div class="label-above">Image:&nbsp;</div>
<a href="/sites/default/files/51b595a0d976ddarkblueLikeGate.jpg" title="Basic Panel" class="colorbox"
rel="gallery-node-20"><img typeof="foaf:Image"
src="/sites/default/files/51b595a0d976ddarkblueLikeGate.jpg"
width="810" height="600" alt="" title="" /></a>
</div>
@Greg-Boggs
Greg-Boggs / gist:6720692
Created September 26, 2013 21:17
git pull and sass compile
* * * * * cd /home/tng/dev.core && /usr/bin/git pull > /home/tng/dev.core.log; /usr/bin/drush -y features-revert-all > /home/tng/dev.core.log 2>&1
* * * * * /bin/bash -c ". /home/tng/.bash_profile > /home/tng/dev.core.log 2>&1; cd /home/tng/dev.core/sites/all/themes/custom/core && /home/tng/.rvm/gems/ruby-1.9.3-p374/bin/bundle exec compass compile > /home/tng/dev.core.log 2>&1"
; Packaging information for core
name = "core"
description = "core"
core = "7.x"
; ----------
; Dependencies
; ----------
; Administration
dependencies[] = admin_menu
dependencies[] = admin_menu_toolbar
@Greg-Boggs
Greg-Boggs / gist:6801988
Created October 2, 2013 23:19
gd test script
<?php
//Report all errors
ini_set("display_errors", "1");
error_reporting(E_ALL);
$image = 'cat.jpg';
//Load image from source provided
$image = imagecreatefromjpeg($image);
@Greg-Boggs
Greg-Boggs / gist:6905591
Last active December 25, 2015 02:49
example profiler profile info
;variables
;Disable core image styles
variables[os_base_remove_core_image_styles] = 1
variables[site_default_country] = US
variables[site_frontpage] = home
variables[api_path] = http://tngdev.com/
variables[moodle_path] = http://moodle.tngdev.com
;users