Skip to content

Instantly share code, notes, and snippets.

View xurizaemon's full-sized avatar
🌻
SPRING

Chris Burgess xurizaemon

🌻
SPRING
View GitHub Profile
# fetching a copy of the repo
vayo:tmp chris$ git clone --branch 7.x-1.x grobot@git.drupal.org:project/uc_paymentexpress.git
Cloning into uc_paymentexpress...
remote: Counting objects: 170, done.
remote: Compressing objects: 100% (117/117), done.
remote: Total 170 (delta 111), reused 79 (delta 53)
Receiving objects: 100% (170/170), 71.57 KiB | 27 KiB/s, done.
Resolving deltas: 100% (111/111), done.
vayo:tmp chris$ cd uc_paymentexpress/
@xurizaemon
xurizaemon / mysql-largest-tables.sh
Created March 15, 2012 02:35
Show largest tables (optionally, in a specific DB)
#!/bin/bash
if [ -z $1 ] ; then
SQL="
SELECT
CONCAT(table_schema, '.', table_name) 'Table',
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') 'Tot Size',
CONCAT(ROUND(table_rows / 1000000, 2), 'M') 'Rows',
CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') 'Data',
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') 'Idx',
@xurizaemon
xurizaemon / civicrm_api_mailing_create.php
Created March 30, 2012 03:32
civicrm_api('mailing', 'create')
<?php
/**
* Handle a create event
*
* @param array $params
* @return array
*/
function civicrm_api3_mailing_create($params, $ids = array()) {
$required = array(
@xurizaemon
xurizaemon / nzg_debug.module
Created April 2, 2012 21:43
debugging lengthy node saves
<?php
function nzg_debug_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
switch ($op) {
case 'insert':
case 'update':
$debug = array(
'request' => $_REQUEST,
'server' => $_SERVER,
'node' => $node,
@xurizaemon
xurizaemon / gist:2300604
Created April 4, 2012 11:58
120s delay during capistrano remote exec
vayo:example-capistrano chris$ date ; cap uat deploy
Wed 4 Apr 2012 23:52:26 NZST
* executing `uat'
triggering start callbacks for `deploy'
* executing `multistage:ensure'
* executing `deploy'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
updating the cached checkout on all servers
@xurizaemon
xurizaemon / x.php
Created April 13, 2012 01:17
views_plugin_query_default.inc
<?php
/**
* @file views_plugin_query_default.inc
* Defines the default query object which builds SQL to execute using the
* Drupal database API.
*/
/**
* Object used to create a SELECT query.
*/
@xurizaemon
xurizaemon / something.rb
Created April 13, 2012 03:58
overriding methods in ruby classes
namespace :drush do
task :backupdb do
end
task :othertask
# boring
long_complex_tasks
very_boring
and_complex
end
end
@xurizaemon
xurizaemon / aliases.drushrc.php
Created April 23, 2012 01:10
auto-load aliases from ~aegir/.drushrc/ for every developer on a machine
<?php
/**
* Aegir user has lots of aliases. Let's load for developers too.
*/
global $aliases;
foreach(glob('/var/aegir/.drush/*alias.drushrc.php') as $aegir_alias) {
require_once($aegir_alias);
}
@xurizaemon
xurizaemon / CRM_Mailing_BAO_Mailing.php
Created April 25, 2012 21:22
CRM_Mailing_BAO_Mailing::getRecipients()
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.1 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2011 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
@xurizaemon
xurizaemon / civicrm-2.2.x-upgrade.patch
Created May 5, 2012 23:29
Patches applied to CiviCRM upgrade process when upgrading DB for EBBC
--- /tmp/civicrm/CRM/Upgrade/Incremental/sql/2.2.alpha1.mysql.tpl 2009-04-14 19:16:47.000000000 +1200
+++ ./CRM/Upgrade/Incremental/sql/2.2.alpha1.mysql.tpl 2012-05-06 11:01:06.000000000 +1200
@@ -15,7 +15,7 @@
-- make the register_by_id cascade in civicrm_participant
ALTER TABLE `civicrm_participant`
- DROP FOREIGN KEY `FK_civicrm_participant_registered_by_id`;
+ DROP KEY `FK_civicrm_participant_registered_by_id`;
ALTER TABLE `civicrm_participant`
ADD CONSTRAINT `FK_civicrm_participant_registered_by_id` FOREIGN KEY (`registered_by_id`) REFERENCES `civicrm_participant` (`id`) ON DELETE CASCADE;