Currently booked up!

I learn something new every day, here’s my live skill feed.


Wed 30th Nov
 

PHP Check for an AJAX call

I just learned that it’s possible to check in php if a request has been made through an ajax call which is handy when you want to return a different template depending on if it’s ajax or not. To do it you just add this snippet:

function is_ajax(){
    return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'));
}

Tue 29th Nov
 

single_cat_title()

When trying to get a category link inside the loop I used to nest a few WordPress functions like this:

<?=get_category_link(get_cat_ID(single_cat_title()));?>

But today it wasn’t working, I discovered after experimenting that this method doesn’t work when you have an apostrophe on your category name and that single_cat_title(); should only be used for actually printing the category. To get the category link you can use this instead:

<?=get_category_link(get_query_var('cat'));?>

Thu 10th Nov
 

:last-of-type

Just discovered the CSS pseudo selector :last-of-type It selects the last element of the type specified. Only works in advanced browsers though.



Sat 5th Nov
 

Good CodeIgniter Google Maps API V3 Library

I found a pretty cool library to help you print out google maps on your sites. You can find it here.

 

CodeIgniter Loops

I discovered a nice method of looping out data in CodeIgniter. I set up a loops module and created a load of view files to handle different loop styles. That way I can print them out anywhere in the site by adding:

<?php $this->load->view('loops/loopname'); ?>

Makes it work a bit like WordPress’ get_template_part() function.


Fri 23rd Sep
 

Tank Auth for CodeIgniter

Tank Auth is an excellent user authorisation library for CodeIgniter. It’s saving me a shit load of time.

 

HMVC in CodeIgniter

Switched my main CodeIgniter project to HMVC this week, it’s much handier for larger sites.


Mon 5th Sep
 

Get Rid of the New Advert in Gmail

There’s a new ad in Gmail. It’s now fixed at the bottom of the page and is really annoying. But you can get rid of it by going to Gmail Settings > Web Clips and unchecking the show web clips box.


Sun 28th Aug
 

get_template_part

Is an extremely easy way of including multiple loop styles in your WordPress themes. Take a look.


Tue 23rd Aug
 

Great Tactic for Software Companies.

Dogfooding – When a company uses the products that it makes. Eating your own dog food expresses confidence in your product.



Get in touch

  • +353834237525