Skip to content

Instantly share code, notes, and snippets.

@kevinchampion
kevinchampion / isu_faculty.install
Created February 21, 2014 21:55
ISU faculty feature module update hooks
<?php
/**
* Change the weight of this module.
*/
function isu_faculty_update_7000() {
db_query("UPDATE {system} SET weight = 88 WHERE name = 'isu_faculty'");
}
/**
@kevinchampion
kevinchampion / buildsrepos_setup_steps.sh
Created March 5, 2014 17:26
Builds repo project provision
1. Provision new vhost
2. Add CNAME record in rackspace
3. Create database and grant new mysql user full rights to it
## Steps for initial setup of buildsrepos
1. Create headless repo in correct directory
2. Create builds repo in correct directory
3. Copy .gitignore, commit, checkout new branch
@kevinchampion
kevinchampion / ng-ckeditor.js
Created June 20, 2014 01:51
ckeditor angular directive
(function(angular, factory) {
if (typeof define === 'function' && define.amd) {
define(['angular', 'ckeditor'], function(angular) {
return factory(angular);
});
} else {
return factory(angular);
}
}(angular || null, function(angular) {
var app = angular.module('ngCkeditor', []);
@kevinchampion
kevinchampion / keybase.md
Created October 25, 2014 22:03
Keybase.io proof

Keybase proof

I hereby claim:

  • I am kevinchampion on github.
  • I am kevinchampion (https://keybase.io/kevinchampion) on keybase.
  • I have a public key whose fingerprint is 8420 A445 C7CA F069 478D 11AF D941 9AD1 21F9 1CC1

To claim this, I am signing this object:

<?php
/**
* @file
* Default theme implementation for beans.
*
* Available variables:
* - $content: An array of comment items. Use render($content) to print them all, or
* print a subset such as render($content['field_example']). Use
* hide($content['field_example']) to temporarily suppress the printing of a
* given element.
@kevinchampion
kevinchampion / drupal_jquery_replace.php
Created March 6, 2015 01:17
Manual Drupal jQuery version change using hook_js_alter().
/**
* Implements hook_js_alter().
*/
function invideous_ooyala_integration_js_alter(&$javascript) {
$node = menu_get_object();
if (!empty($node) && $node->type == 'event') {
$state = _eversport_videofield_get_state($node);
@kevinchampion
kevinchampion / hook_views_pre_view-wrapper.php
Created December 14, 2011 04:54
Using hook_views to programmatically filter a view in Views 3, Drupal 7
function lsadataclassify_views_pre_view(&$view, &$display_id, &$args){
if ($view->name === 'protection_measures' && $view->current_display === 'page'){
}
}
@kevinchampion
kevinchampion / drupal_mail_example.inc
Created May 17, 2012 21:03
Figure out Drupal 7 mail formatting
/**
* @param $form
* @param $form_state
*/
function lsadataclassify_keyad_route_submit($form, &$form_state) {
global $base_url;
// For each pm checked
for ($i = 0; $i < $form_state['values']['num_compliance']; $i++){
if ($form_state['values']['row-' . $i]['route'] == 1){
@kevinchampion
kevinchampion / gist:2778134
Created May 23, 2012 22:11
Redirecting in hook_user (Drupal 6)
/**
* Implements hook_user().
*/
function gpxhacks_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
case 'load':
if ($account->login == 0) {
$account->redirect_after_login = 'user/' . $account->uid . '/edit';
}
@kevinchampion
kevinchampion / lsadataclassify.rules.inc
Created July 6, 2012 19:16
Drupal create rules event
/**
* Implements hook_rules_event_info().
*/
function lsadataclassify_rules_event_info() {
return array(
'lsadataclassify_submission_completed' => array(
'label' => t('A submission has been completed'),
'group' => t('Research Data'),
'module' => 'lsadataclassify',