Skip to content

Instantly share code, notes, and snippets.

View tenken's full-sized avatar

David Gurba tenken

View GitHub Profile
@tenken
tenken / dc_pages.features.content.inc
Created February 28, 2012 17:53
default content export of nodes
<?php
/**
* @file
* dc_pages.features.content.inc
*/
/**
* Implements hook_content_defaults().
*/
function dc_pages_content_defaults() {
@tenken
tenken / dc_pages.info
Created February 28, 2012 17:54
default content info file
name = "dc_pages"
description = "page content"
core = "7.x"
package = "Features"
version = "7.x-1.0"
project = "dc_pages"
features[content][] = "page:academics"
features[content][] = "page:academics/eap-credit"
features[content][] = "page:academics/grades"
features[content][] = "page:academics/graduting-senioers"
@tenken
tenken / dc_pages.module
Created February 28, 2012 17:55
dc_pages blank module file
<?php
/**
* @file
*/
// Drupal needs this blank file.
@tenken
tenken / dc_pages.install
Created February 28, 2012 17:57
dc_pages .install file, sets Page content type pathauto pattern
<?php
function dc_pages_enable() {
variable_set('pathauto_node_page_pattern' ,'[node:menu-link:parent:url:path]/[node:title]');
}
@tenken
tenken / gist:2039318
Created March 14, 2012 20:35
sample file to assign nodes to be owned by groups for OG 1.x (~1 year ago) under Drupal 7.
<?php
# @author webdev@id.ucsb.edu
$entity_groups = entity_load('group', FALSE);
#
# The Group Entities were created in the order the D6 DomainAccess site had the
# subdomain id's stored in the database. We can simply iterate through the
# Entity list we get back and look for nodes in that DA/GID "id" value and
@tenken
tenken / gist:2173251
Created March 23, 2012 18:00
php 5 "closure"
<?php
function courses_db_form_alter(&$form, $form_state, $form_id) {
if ($form['#id'] == 'views-exposed-form-catalog-listings-page' && $form_id == 'views_exposed_form') {
$max_comparator = function ($max) {
return function ($v) use ($max) { return (intval($v) > 0) ? $v < $max : TRUE; };
};
# this form value starts with "--Any--", we want to inlcude that always.
$form['field_coursedb_year_tid']['#options'] =
@tenken
tenken / gist:2175665
Created March 23, 2012 22:22
theme_item_list
<?php
/**
* Implementation of hook_views_pre_render().
*/
function faculty_db_simple_views_pre_render(&$view) {
if ($view->name === 'faculty_rolodex' ) {
$index = array_merge(array('0-9'), array('all'), range('a','z'));
foreach ($index as $letter) {
$class = arg(1) == strtolower($letter) ? 'active' : '';
$link = l(t($letter), arg(0).'/'.strtolower($letter));
@tenken
tenken / shortprofile.info
Created March 29, 2012 22:17
A Sample short profile that auto-fills the DB form, its a little ugly.
; dpg ::: http://drupal.org/user/1059226
; Example Short Profile -- hides database configuration page.
;
; This bears mentioning more than once. See http://drupal.org/node/1153646
name = Short Profile
description = A short profile, it removes DB settings page.
core = 7.x
dependencies[] = block
@tenken
tenken / views_fs.callbacks.inc
Created May 23, 2012 22:47
Sample code to read remote files mounted for D7 access. This is just a working example and not an official module i support.
<?php
function views_fs_file_list_content() {
$page = array();
$files = _views_fs_fetch_filelist();
return $page;
}
@tenken
tenken / wol.rb
Last active August 29, 2015 14:21 — forked from zunda/wol.rb
#!/usr/bin/ruby
# wol.rb: sends out a magic packet to wake up your PC
#
# Copyright (c) 2004 zunda <zunda at freeshell.org>
#
# This program is free software. You can re-distribute and/or
# modify this program under the same terms of ruby itself ---
# Ruby Distribution License or GNU General Public License.
#