How to
Information on how to do something... anything.
Stefan set up the kgb-bot to post in the Agaric IRC channel when anyone pushes a commit to one of our repositories. These repositories are hosted on our server, and each one needs to have a very simple bit of configuration added to it and to the KGB server configuration when we add one.
Here's the easiest way for me to do that. For information about getting started with KGB in the first place, see http://www.donarmstrong.com/posts/switching_to_kgb/
We're doing some functions tests for cfwheels even though the main docs - http://code.google.com/p/cfwheels/wiki/TestingFramework - have only controller, model, view. Trying to test our showUserText() function alone failed because it was telling me it doesn't know anything about other functions it calls that are in fact core to CFWheels (stripTags, in this case).
For development, you don't want any e-mail sent to the outside world, but you do want to be able to see all mail your sites or application try to send. Here is a configuration of Postfix to do that.
The trick is to BCC everything to a local user, and discard without error any other sending.
This is based on several guides and Q&As online but well, none of them worked for me, so here's exactly what i did (minus all the missteps).
A principal at Agaric regrettably uses Microsoft Windows as a primary operating system. In fact, though, everything works great for him using the open source integrated development environment Eclipse to develop, including using the eGit plugin-- except when something goes wrong, and my (limited) command line knowledge of Git is useless to help him.
Fortunately, it turns out to be pretty easy to have command-line Git on Windows with Eclipse, it just isn't well documented.
<?php
/**
* Alter the admin menu to show main menu links there also (for admin pages).
*/
function example_admin_menu_output_alter(&$content) {
// Retrieve the Main menu link tree.
$tree = menu_build_tree('main-menu');
$links = admin_menu_links_menu($tree);
if (!empty($links)) {
// Fake out a top-level main menu link.
$links['#title'] = t('Main menu');
$links['#href'] = '<front>';
$links['#options'] = array(
'alias' => true,
);
$links['#weight'] = 100;
debug($links);
$content['menu']['main_menu'] = $links;
}
}
?>
And use a real ellipses!
Drupal's theme_username() is used many places within Drupal, and shortens any name over 20 characters, which can be a lot if you encourage people to use full names. This can be undone with a preprocess function in your module or theme, just replace EXAMPLE with your module or theme name.
If you've already been committing code to master, do this to start a new 7.x branch and kill off the code in the master branch so noone gets confused.
cd /path/to/repo
git checkout -b 7.x-1.x
git push origin 7.x-1.x
git checkout master
git rm -r *
echo "Real code is not kept on the master branch, to see the code: git checkout 7.x-1.x" > README.txt
git add README.txt
git commit -m "Add a README explaining that the master branch is empty."
git push origin master
Here's the basics of defining and using a JQuery plugin within the context of Drupal.
This is definitely not the best and highest use of a plugin, and may in fact be a downright abomination-- this isn't a plugin that really works outside the context of the code it is written for, and certainly not outside Drupal. But it was a clean way to abstract out 42 lines of code, so here it is, for the enjoyment of all.
The first part here is simply how to call JQuery from Drupal, the second part is the plugin.
There's two separate cool things here that you might want to do. One, simply know how to save a file from a URL (there's a secret Drupal function for that in system module) and two, how to give an image field a default image when creating it programmatically (that part is outsourced to the fieldhelp module).