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
#!/usr/bin/ruby
require "csv"
class Array
def sum
inject(nil) { |sum,x| sum ? sum+x : x }
end
def average
#!/bin/sh
MYSQLDUMP_DIR='/Users/blah/Sites/db_backups'
CURDATE=`date +%F`
for SITE in $(ls sites/)
do
if [[ -f sites/${SITE}/settings.php ]]
then
# Retreive DB information from settings.php file
DBURL=$(grep '^$db_url' sites/${SITE}/settings.php | sed "s#.*'\(.*\)'#\1#")
#!/usr/bin/env ruby
require 'statgrab'
require 'json'
sg = Statgrab.new
stats = {}
#puts "#{sg.memory[:free]/1024}m"
#puts sg.memory.to_json()
#!/bin/bash
LATEST=$(curl -o - http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/LATEST)
WGET=$(which wget)
${WGET} "http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/${LATEST}/chrome-mac.zip"
if [[ -f "chrome-mac.zip" ]]
then
unzip chrome-mac.zip
fi
#!/usr/bin/ruby
require 'rubygems'
require 'gdata'
require 'zlib'
require 'fastercsv'
require 'twitter'
=begin
This script was used at DrupalCamp Dallas 09 to post schedule changes made on a google spreadsheet to twitter.
=end
<?php
/**
* Implementation of hook_ctools_context_convert_list().
*/
function misc_ctools_context_convert_list($plugin, &$converters) {
if ($plugin['name'] == 'node') {
$converters = $converters + array('field_firstname' => t('First Name'), 'field_lastname' => t('Last Name'));
}
return $converters;
}
Drupal.behaviors.modulename = function() {
Drupal.settings.modulename = new Object();
Drupal.settings.modulename.count = 0;
jQuery.fn.slideFadeToggle = function(speed, easing, callback) {
return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback);
};
<?php
// Create the return filepath. We add the bucket file path if
// the a custom domain is not being used
preg_match('@^(?:https?://)?([^/]+)@i', $settings['mm_s3_server_url'], $domain);
if ( $domain[1] == 's3.amazonaws.com') {
$s3_filename = $bucket . '/' . $s3_filename;
}
return $settings['mm_s3_server_url'] . $s3_filename;
?>
Index: mm_s3.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/media_mover/contrib/mm_s3/Attic/mm_s3.module,v
retrieving revision 1.1.2.2.2.30
diff -u -p -w -r1.1.2.2.2.30 mm_s3.module
--- mm_s3.module 7 Dec 2009 15:44:53 -0000 1.1.2.2.2.30
+++ mm_s3.module 20 Dec 2009 00:41:57 -0000
@@ -424,7 +424,10 @@ function mm_s3_send($file, $configuratio
// Create the return filepath. We add the bucket file path if
<?php
function apci_media_mover_import($config_filename) {
if (module_exists('media_mover_api')) {
$config_code = file_get_contents(drupal_get_path('module', 'apci_media_mover') . '/' . $config_filename . '.mm');
// evaluate imported code
ob_start();
eval($config_code);
ob_end_clean();