Skip to content

Instantly share code, notes, and snippets.

View msonnabaum's full-sized avatar

Mark Sonnabaum msonnabaum

  • Lithic
  • San Diego, CA
View GitHub Profile
<?php
if (is_array($contrib)) {
foreach ($contrib as $person) $names[] = $person->FirstName . ' ' . ucwords($person->LastName);
} else if (isset($contrib)) $names[] = $contrib->FirstName . ' ' . ucwords($contrib->LastName);
if ($names) $contrib_str = implode(', ', $names);
$sessions[$key]['field_session_contributor_names_value'] = $contrib_str;
<?php
$options['shell-aliases'] = array(
'cd' => '!cd `drush dd`',
);
diff --git a/drush.php b/drush.php
index 7a427af..c834dd0 100755
--- a/drush.php
+++ b/drush.php
@@ -113,7 +113,7 @@ function drush_main() {
$return = '';
}
- if (drush_get_context('DRUSH_DEBUG')) {
+ if (drush_get_context('DRUSH_DEBUG') && !drush_get_context('DRUSH_QUIET')) {
<?php
function blah_init() {
global $user;
if ($user->uid = 1) {
// do something
}
}
<?php
$contexts = ctools_context_handler_get_handler_contexts($base_contexts, $handler);
if (isset($handler->handler)) {
ctools_context_handler_pre_render($handler, $contexts, $args);
}
$context = $contexts[$handler->conf['content_type_render']];
$conf['nid'] = $context->data->nid;
<?php
function welcom_user_load($profile_info) {
// Create a new view
$view = views_new_view();
$view->name = 'welcom_user_lookup';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$handler = $view->new_display('default', 'Defaults', 'default');
<?php
$uid = db_result(db_query("SELECT n.uid
FROM content_type_profile ctp
LEFT JOIN node n ON ctp.nid = n.nid
WHERE field_blah_id_value = %d", $blah_id));
$account = user_load($uid);
# ANSI color codes
# Reset
Color_Off='\e[0m' # Text Reset
# Regular Colors
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
@msonnabaum
msonnabaum / gist:1000466
Created May 31, 2011 13:05
drush archive-dump test
<?php
/*
* @file
* Tests for archive.drush.inc
*/
class archiveDumpCase extends Drush_TestCase {
/*
* Test dump and extraction.
" Format json using the "json" command from npm
func FJSON()
%! json
set filetype=javascript
nohl
normal! gg=G
endfu
com -nargs=* FJSON call FJSON()