If you need to align anything vertically in CSS, apply the following class:

.verticalAlign {
position: relative;
top: 50%;
transform: translateY(-50%);

Posted by

Drupal’s default clearfix CSS leaves a gap at the bottom of the page, this removes this:

.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
font-size: 0;

.clearfix { display: inline-block; }
/* \*/
* html .clearfix { height: 1%; }
.clearfix { display: block; }
/* */

Posted by

If you need to create a file object through the Drupal api then use the following code:

filename = basename('{CURRENT PATH}');
$file->filepath = '{CURRENT PATH}';
$file->filemime = file_get_mimetype($file->filename);
$file->filesize = filesize('{CURRENT PATH}');
$file->uid = $user->uid;
$file->status = FILE_STATUS_TEMPORARY;
$file->timestamp = time();
$file->list = 1;
$file = file_save($file);
$file = file_move($file, 'public://');
$file->status = FILE_STATUS_PERMANENT;
$file = file_save($file);

Posted by

If you need to create a node within your module then use the following code:

title = '{NODE TITLE}';
$node->type = '{NODE TYPE}';
$node->language = LANGUAGE_NONE;
$node->uid = $user->uid;
$node->status = 1;
$node->promote = 0;
$node->comment = 0;
$node = node_submit($node);

Posted by

The following code is used if you want to define a new block within a Drupal module. Replace hook_ with your modules name.

t('Block Description'),
return $blocks;

function hook_block_view($delta = '') {
$block = array();
switch ($delta) {
case 'block-name':
$block['content'] = hook_custom_function();
return $block;

function hook_custom_function(){
$content = "Block Content";
return $content;

Posted by

Switchweb are offering help managing WordPress websites, this could include installing themes or plugins, running updates or configuring various areas of the admin section.

We can also clean malware & virus’ from your WordPress installation and migrate from your existing host.

For more information please contact switchweb@switchweb.co.uk .

Posted by

Here are a selection of great OS X shortcuts:

cmd + shift + 3 – screenshot
cmd + shift + 3 – cropped screenshot
cmd + shift + 3 then press spacebar will crop the screenshot around the current window

ctrl + cmd + space – full emoji keyboard

cmd + ~ – switches between windows in same application

shift + option when changing volume uses quarter increments

cmd + option + shift + V – paste & match text formatting

cmd + space – shows spotlight

cmd + H – hides active application

cmd + opt + H – hides all windows not in focus

alt + backspace – delete a whole word instead of a letter at a time

control + command + power (eject) – system restart

cmd + shift + i (from a Safari or Chrome) – creates a new email with the URL of the page you were visiting in the body

control + d – replicates the ‘Delete’ key from non-mac keyboards

option + right click on a dock app to show force quit

option + click on wifi icon in menu bar to show wireless speed, strength and other useful details

Thanks to reddit.com/r/apple for some of these.

Posted by

1. Install HomeBrew

2. Run the following from the terminal:

$ brew install youtube-dl
$ brew install ffmpeg
$ brew install lame

3. Get the URL of the YouTube video

4. At the terminal:
$ youtube-dl http://YouTubeURL

5. The downloaded file will be a .mp4 file, convert it to wav —
$ ffmpeg -i DownloadedFileName.mp4 TargetFileName.wav

6. Finally convert to MP3
$ lame FileName.wav FileName.mp3

Posted by