Skip to content

Instantly share code, notes, and snippets.

View clrockwell's full-sized avatar
🏠
Working from home

Chris Rockwell clrockwell

🏠
Working from home
  • Vanderbilt University Medical Center
View GitHub Profile
@clrockwell
clrockwell / exhibitor_events.module
Last active August 29, 2015 13:58
Unfortunately, I don't remember why I didn't make exhibitor events as content types instead of managing them this way. It was originally done for D6 and I've only made the necessary updates for D7
<?php
/**
* Exhibitor Events
*
* Manage exhibitor events such as Celebrity Appearances, Give-A-Ways, etc.
**/
/**
* Implementation of hook_perm()
*/
@clrockwell
clrockwell / presskit.tpl.php
Created April 2, 2014 03:31
Another example of a simple .tpl.php file
<?php
/* $presskits */
?>
<table class="presskit-schedule schedule-table" border="0" cellpadding="10">
<?php
foreach ($presskits as $itemNo => $kit) {
?>
<tr class="presskit_row-<?php print $itemNo % 2 == 0 ? 'even' : 'odd'; ?>">
<td class="presskit-schedule_presskit-company">
<?php print $kit->company_name; ?>
@clrockwell
clrockwell / important_dates.module
Created April 2, 2014 03:33
truckingshow.com has a *lot* of dates to keep up with; this makes displaying them site wide very easy, including within nodes that have the PHP filter turned on. Use of the DateAPI was crucial in working out timezone issues (as Drupal saves times in UTC)
<?php
/**
* @file
* Give access to important dates
* based on date nodes
*/
function important_dates_menu() {
$items['test-form'] = array(
@clrockwell
clrockwell / phplist_integrate.module
Created April 2, 2014 03:34
As attendee registers, they are also added as a PHPList user; this is old
<?php
// $Id$
/**
* @file
*
* Add/Remove email addresses to/from phplist
* from Drupal pages
*
*/
@clrockwell
clrockwell / block--block-10.tpl.php
Created April 2, 2014 03:37
Just templating a block; too much logic is in this one though, should maybe be moved to a preprocessor
<?php
shuffle($nodes);
?>
<div class="product-showcase-carousel">
<h2 class="block-title-custom">Product Showcase
<a href="product-showcase/create" class="smallh2"> + Create A Listing</a>
<span class="smallh2">/</span> <a href="product-showcase" class="smallh2">View All Listings</a>
</h2>
<div class="ps-nav ps-prev">Previous</div>
<div class="product-showcase-carousel-wrap">
@clrockwell
clrockwell / smoothAccordion.js
Created April 2, 2014 03:39
Had a seemingly rare requirement for an accordion that the designer could specify which sections were open and closed by default -- requires the accordion to calculate height of several elements rather than just, for example, a heading
/**
* @file
*
*
*
*/
(function ($) {
Drupal.behaviors.listen_to_open = function (item) {
@clrockwell
clrockwell / Form-onsubmit-handler.markdown
Created May 18, 2014 18:51
A Pen by Chris Rockwell.

Form onsubmit handler

Using a 3rd party platform for a mobile app we are restricted to HTML/CSS only. We need a very simple calculator that is only used to display info back to a user - no processing is done. I'm using some JavaScript directly in the onsubmit to accomplish this. Ugly, but satisfies this specific use case.

A Pen by Chris Rockwell on CodePen.

License.

<?php
// $Id$
/**
* Implementation of hook_perm()
*/
function sugar_crm_perm() {
//return array();
}
@clrockwell
clrockwell / gist:75d7875a801689c990aa
Created October 22, 2014 20:00
wget entire site
wget -E -H -k -K -p -e robots=off http://domain.com
@clrockwell
clrockwell / octal permissions
Created October 31, 2014 13:47
Get octal permissions of file
stat -c "%a %n" file/name