Skip to content

Instantly share code, notes, and snippets.

<?
$node_type = strtolower(GET_NODE_MACHINE_NAME); // easy and optional
$entities = entity_load('node', array($row->field_photo)); // node, or any other entity type
$uri = $entities[$row->field_photo]->field_photo['und'][0]['uri'];
$layout = strtolower(taxonomy_term_load($entities[$row->field_photo]->field_layout['und'][0]['tid'])->name);
return image_style_url($node_type . "_" . $layout, $uri);
?>
@chadsten
chadsten / gist:5886286
Created June 28, 2013 17:07
My vhosts setup
# sites-enabled/eco
<VirtualHost *80>
DocumentRoot /var/www/eco/
ServerName eco.localhost
<Directory /var/www/eco/>
Options Indexes FollowSymLinks MultiViews +Includes
AllowOverride All
Order allow,deny
allow from all
</Directory>
<?
#$case = "2013-07-17 18:15:00 to 2013-07-19 18:15:00";
$case = "2013-07-25 18:15:00 to 2013-07-25 19:15:00";
#$case = "2013-07-24 19:00:00";
#$case = "2013-07-28 14:00:00 to 2013-07-30 22:00:00";
$set = split(' to ', $case); // Split the to and from dates up first
foreach ($set as $item) {
$raw[] = split(' ',$item); // Split the time and date up
}
<div class="<?php print $classes; ?>"<?php print $attributes; ?>>
<?php if (!$label_hidden): ?>
<div class="field-label"<?php print $title_attributes; ?>><?php print $label ?>:&nbsp;</div>
<?php endif; ?>
<div class="altered field-items"<?php print $content_attributes; ?>>
<?php dpm($items); ?>
<?
list($start, $end) = explode(' to ', $items[0]['#markup']);
list($start_date, $start_time) = explode(' ', $start);
list($end_
<?php
list($start, $end) = explode(' to ', $items[0]['#markup']);
$time_format = 'g:i A';
$date_format = 'F jS, Y';
$start = strtotime($start);
$start_date = date($date_format, $start);
$start_time = date($time_format, $start);
if ($end) {
$end = strtotime($end);
$end_date = date($date_format, $end);
@chadsten
chadsten / gist:6105518
Created July 29, 2013 16:19
After css2sass
/**
* @file
* Page Styling
*
* Style the markup found in page.tpl.php. Also includes some styling of
* miscellaneous Drupal elements that appear in the $content variable, such as
* ul.links, .pager, .more-link, etc.
*/
/* Inner page - Basic pages ( Page )*/
@chadsten
chadsten / gist:6105522
Created July 29, 2013 16:19
Before css2sass
/**
* @file
* Page Styling
*
* Style the markup found in page.tpl.php. Also includes some styling of
* miscellaneous Drupal elements that appear in the $content variable, such as
* ul.links, .pager, .more-link, etc.
*/
<div class="field-content"><span data-picture data-alt="">
<span data-src="http://hamilton.dev.encoredemo.com/sites/default/files/styles/slider/public/3.jpg?itok=xg5tCAQg" width="1310" height="555"></span>
<span data-media="(max-width: 479px)" data-src="http://hamilton.dev.encoredemo.com/sites/default/files/styles/slider_breakcustom_user_mobile_1x/public/3.jpg?itok=pTUjcgWs" width="479" height="436"></span>
<span data-media="(max-width: 479px) and (min-device-pixel-ratio: 1.5), (max-width: 479px) and (-o-min-device-pixel-ratio: 1.5), (max-width: 479px) and (-webkit-min-device-pixel-ratio: 1.5), (max-width: 479px) and (min-resolution: 1.5dppx)" data-src="http://hamilton.dev.encoredemo.com/sites/default/files/styles/slider_breakcustom_user_mobile_1_5x/public/3.jpg?itok=7nHFgruD" width="479" height="436"></span>
<span data-media="(min-width: 480px)" data-src="http://hamilton.dev.encoredemo.com/sites/default/files/styles/slider_breakcustom_user_small_tablet_1x/public/3.jpg?itok=lTTHXiwv" width="679" height="2
<?php
$markup['5578'] = "Congratulations, your <strong>" . $vehicle->title . "</strong> is awaiting your arrival on GETVARTODO. If you have any questions, please call 877-615-3187.";
$page['content']['system_main']['nodes'] = array (
'#markup' => $markup[$vehicle_id],
function! s:sassOpenCT(ct)
let contenttype=a:ct
:vsp sites/all/themes/main/sass/content-types/_.fnameescape(contenttype)..scss
endfunction
command! -nargs=1 SassCT call s:sassOpenCT(<q-args>)