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_object_prepare($node);
$node->language = LANGUAGE_NONE;
$node->uid = $user->uid;
$node->status = 1;
$node->promote = 0;
$node->comment = 0;
$node = node_submit($node);
node_save($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();
break;
}
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


Switchweb accounts come with unlimited mailboxes, this simple guide shows how easy it is to create and manage them.

1. Login to your control panel through www.extendcp.co.uk

2. Scroll down to Email and click on Mail Boxes.

Screen Shot 2014-06-10 at 20.36.08

3. Enter the alias you want to use as the mail box and click add.

Screen Shot 2014-06-10 at 20.36.56

4. Listed below the add form are the mail boxes you have already created. Click on the email address to view its webmail.

If you still get stuck feel free to contact Switchweb support.

Posted by