User login

code

Duck Programming

http://unspace.ca/blog/duck-programming/

Duck programming is manageable. It starts with recognizing that while it may be designed to be carried out by people who are not professional coders, it is still programming, and must be managed with the same processes you use to manage code:

Simplify Drupal by Building Core Features with Building Blocks

It takes a very long (and enlightening and entertaining and informative) article to get there, but Jeff Eaton makes the key point which i think we all know in Drupal but can have trouble expressing. This is the key big picture for very many of our Drupal 8 initiatives:

More executable paths through code correlates with higher likelihood of bugs

The McCabe Cyclomatic Complexity metric (which counts the number of different executable paths through a module) proves to be an excellent measure of code quality. The more paths through a program, the more complicated it is, and the more bugs the program is likely to have.

http://www.enerjy.com/blog/?p=198

Capturing Menu Block configuration in code with hook_menu_block_blocks()

<?php
/**
* Implements hook_menu_block_blocks().
*/
function feature_about_menu_block_blocks() {

Create a nodequeue programatically

In your hook_install() and/or hook_update_N() implementation, this sort of code will create a new nodequeue (if it already exists, you'll only get database errors, though this could be worked around with a bit more code if for some reason you couldn't rely on what the site you are updating has or not).

Removing the current node's ID from an array of node IDs

Didn't work:

<?php
  // Remove the current node ID, if present.  This looks crazy but it's fast,
  // see http://lixlpixel.org/php-benchmarks/remove-array-items-by-value
  if ($nids) {
    $nids = explode(',', str_replace($current_nid . ',', '', join(',', $nids)));
  }
?>

Worked:

Putting a local project maintained in git on a server as a central repository

Note: The agaric git repository is not public, but this approach will work on your own server.

Stefan explained: copy your folders to your home dir on the server, cd to /srv/git and then run git clone --bare folder folder.git

cd ~
scp -r customhome ben@grassrootsconnection.org:~/customhome

On the server:

ben@server:/srv/git/agaric$ git clone --bare ~/customhome customhome.git

Initialized empty Git repository in /srv/git/agaric/customhome.git/

And don't forget!

Syndicate content