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
<?php
/**
* Room Report
* @see cela_reports.room_utilization.inc
*/
function cela_reports__report_tables__rooms($type = ['phs_event', 'stp_event']) {
$working_hours = cela_reports__working_hours__monthly_report();
$used_rooms = cela_reports__room_utilization__get_rooms([$type], cela_reports__utilization__report_dates());
$event_rooms = cela_reports__room_utilization__get_event_data($used_rooms);
$data = cela_reports__room_utilization__get_room_utilization($event_rooms);
<?php
function _array_column($input, $column_key, $index_key = NULL) {
if (function_exists('array_column')) {
return array_column($input, $column_key, $index_key);
}
$result = [];
array_walk($input, function($item) use (&$result, $column_key, $index_key) {
if (!array_key_exists($column_key, $item)) {
return;
<?php
/**
* @file
* Functions to build working hours
* @
*/
define('WORKING_REPORTS_MONTH_YEAR_START', 7); // July
define('WORKING_REPORTS_MONTH_YEAR_END', 6); // June
define('WORKING_REPORTS_HOURS_IN_DAY', 8);
<?php
/**
* Get count of holidays in a given month
* Holidays are a content type with a date field
*
* @param int $month The month
* @param int $year The year
*/
function cela_reports__working_hours__holidays_month($month, $year) {
$holidays = db_select('field_revision_field_event_dates', 'f')
<?php
$_full = TRUE;
if(!$this->drupal_bootstraped) {
$api_path = getcwd();
define('DRUPAL_ROOT', $this->drupal_root);
chdir($this->drupal_root);
//D7 is going to have GlobalRedirect interfere, set POST value to disabled it.
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
$_POST['X-MEDIQ_GLOBAL_REDIRECT_DISABLE'] = 'TRUE';
if ($_full) {
switch(skus.length) {
case 4:
jQuery(skus[skus.length-1]).css('left', '217px').css('position','relative');
break;
case 5:
jQuery(skus[skus.length-1]).css('left', '109px').css('position','relative');
jQuery(skus[skus.length-2]).css('left', '109px').css('position','relative');
break;
default:
break;
@clrockwell
clrockwell / octal permissions
Created October 31, 2014 13:47
Get octal permissions of file
stat -c "%a %n" file/name
@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
<?php
// $Id$
/**
* Implementation of hook_perm()
*/
function sugar_crm_perm() {
//return array();
}
@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.