Skip to content

Instantly share code, notes, and snippets.

View glennpratt's full-sized avatar

Glenn Pratt glennpratt

View GitHub Profile
<?php
/**
* Migrate CCK date start with optional duration to date start and date end.
*/
function _apci_aldt_migrate_group_dep_migrate_event_date(&$source_node, &$target_node) {
$target_node->field_date = array();
$duration = $source_node->field_duration[0]['value'];
<?php
//module_load_include('inc', 'user', 'user.pages');
//$form_id = 'user_register';
module_load_include('inc', 'node', 'node.pages');
$form_id = 'group_node_form';
$form_state = array();
$args = array($form_id, $form_state);
// Make sure $form_state is passed around by reference.
$args[1] = &$form_state;
Event Event Category Start End Resource
Helper A vs. Helper B 08/05/2010 - 5:35pm 08/05/2010 - 6:05pm Helping Field
Helper A vs. Helper B 08/08/2010 - 5:35pm 08/08/2010 - 6:05pm Helping Field
Helper A vs. Helper B 08/11/2010 - 5:35pm 08/11/2010 - 6:05pm Helping Field
Helper A vs. Helper B 08/14/2010 - 5:35pm 08/14/2010 - 6:05pm Helping Field
<?php
$date = new DateTime('2011-03-13T03:00:00', timezone_open('America/Chicago'));
dpm($date->format('c e'));
$date2 = clone($date);
$date2->modify('-2 minutes');
dpm($date2->format('c e'));
if ($date->format('U') < $date2->format('U')) {
$date2->modify('-120 minutes');
# ${HOME} will be replaced by JVM user.home system property
netbeans_default_userdir="${HOME}/.netbeans/6.9"
# Options used by NetBeans launcher by default, can be overridden by explicit
# command line switches:
netbeans_default_options="-J-client -J-d64 -J-Xss4m -J-Xms512m -J-Xmx1024m -J-XX:PermSize=64m -J-XX:MaxPermSize=1024m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dawt.nativeDoubleBuffering=true -J-XX:+UseAdaptiveSizePolicy -J-Djava.net.preferIPv4Stack=true -J-XX:+AggressiveOpts -J-XX:+AggressiveHeap"
# Note that a default -Xmx is selected for you automatically.
# You can find this value in var/log/messages.log file in your userdir.
# The automatically selected value can be overridden by specifying -J-Xmx here
# or on the command line.
gpratt@vbox:/mnt/apci/main$ git submodule update --init
fatal: reference is not a tree: 5f734a588995638b9ab63b80b8771902aad85155
Unable to checkout '5f734a588995638b9ab63b80b8771902aad85155' in submodule path 'www/sites/all/modules/contrib/og_services'
gpratt@vbox:/mnt/apci/main$ git submodule sync
Synchronizing submodule url for 'www/sites/all/modules/allplayers/apci_js_libraries/fullcal'
Synchronizing submodule url for 'www/sites/all/modules/contrib/og_services'
Synchronizing submodule url for 'www/sites/all/modules/contrib/services'
gpratt@vbox:/mnt/apci/main$ git submodule update --init
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (3/3), done.
[user]
name = Glenn Pratt
email = glenn@allplayers.com
[color]
grep = auto
diff = auto
status = auto
branch = auto
ui = auto
[color "diff"]
# /etc/apt/preferences.d/php
Package: libapache2-mod-php5
Pin-Priority: 991
Pin: release a=karmic
Package: libgv-php5
Pin-Priority: 991
Pin: release a=karmic
@glennpratt
glennpratt / gist:736468
Created December 10, 2010 17:02
distinct query
SELECT node.nid AS nid,
node.TYPE AS node_type,
node.vid AS node_vid,
apci_game_results.result_rendered AS
apci_game_results_result_rendered,
Distinct(apci_game_results.tid) AS apci_game_results_tid,
node_data_field_date.field_date_value AS
node_data_field_date_field_date_value,
node_data_field_date.field_date_value2 AS
node_data_field_date_field_date_value2,
@glennpratt
glennpratt / ab
Created February 7, 2011 18:26
Completely unscientific testing of module_implements cache and loadcache.
// Execution time
baseline => 100%
module_implements => 37%
all cache => 24%
// module_implements cache + user_load static, user_load persistent and node_load persistent cache
new-host-3:DrupalBench gpratt$ ./drplb.sh -n 5 -c 2 http://vbox.allplayers.com/users/glenn
Drupal Login: glenn