Dynamically load Twitter Tweet and Facebook Like button

This is a good technique to use as it saves having to load loads of share buttons on every page load which often slow the page down. Just had to do this and needed a few lines to get it working.

Whether you have the code hidden somewhere on your page before it's needed or load it via AJAX is irrelevant, but once it's included on the page, you need the following code to initialise the buttons. 

if(typeof twttr != 'undefined')
{
	twttr.widgets.load();
}
FB.XFBML.parse(document.getElementById('container'));

If you add one Tweet button dynamically it seems to initialise itself, but later ones need this code. As well as this, 'twttr' won't exist until the first one is created but will after, so we only need to run that once it's defined; isn't needed for the first one anyway.

For the Facebook one, you need to specify the ID of a container of the post or something, and it'll find any FB elements inside that it needs to initialise.

After that, should work fine.

New site!

Hello.

Over the past few weeks I've been writing a new site and it's at a state now where I can replace my current one. WordPress is good but has loads of stuff that I don't use and I don't really know how it works, and I've always wanted to build my own site, so here we go.

As you can probably see, I'm not a designer, but sometimes less is more. Think it looks alright myself.

I've built this using the Kohana PHP framework (the older one as we use it at work and I know it, couldn't be bothered to learn a newer framework as I just wanted to get this built) and Twitter Bootstrap as the front end framework, which I now love. It makes the site responsive (scales nicely to fix widescreens, normal screens, tablets and smartphones) and comes with loads of utility styles to save you loads of time. That's what I like about using frameworks, they save you writing all the crappy boring stuff and let you get straight into building what you want.

I've also got a little Ask Me feature like Tumblr/Formspring so feel free to ask me something if you have nothing better to do.

Things will probably be a bit broken but I'm sure I'll find the problems myself soon enough.

I've imported some of the better/more recent posts from my old site (which can still be found here). Please forgive some of the silly things I went on about when I was a bit younger.

If you have any feedback on the site then please let me know as I'll always be looking to improve it.

I'll also try to use this one a bit more than my old one too :)

So... What's new?

I'll go first.

  • I work at a cool web development/design/digital/media company in Norwich, Selesti. I make websites and stuff and work with some really cool people. I've learnt a lot there over the year and 4 months I've been there, and my coding's really improved. Plus, free breakfast on Fridays.
  • My car is still running despite not yet passing an MOT first time. Welding needs doing and some (often original) parts need replacing every now and then, but it's at 117K miles and is still going well, if you overlook some rust (it is 24 years old though). Testament to German engineering. Had some fun recently when the head gasket almost blew; engine overheated badly, turned out they'd missed a split radiator hose; we replaced it, all good, and it's run better since.
  • I went to New York last year. Great place, recommend you go if you get the opportunity. Went to all the usual attractions and very much enjoyed it. We were there when Hurricane Irene hit. It was rubbish. What they call a hurricane, we call a summer's day.
  • Still don't have a girlfriend but the less said about that the better #foreveralone In fairness I haven't really tried.
  • I've aged. I'm 21 now. Twenty-fucking-one.
  • I still spend too much of my time sat in front of a computer.
  • I still haven't had time to get into iPhone app development.

That's a brief overview of me since 2011.

So... Uh... Yeah...

So, 1 year, 7 months, and 10 days ago I posted saying I'd post more.

I think I did well.

So I'll say it again, I'll try and post more. Well, not more, just post. Anything would be more.

Eventually I'll replace this site with something custom (e.t.a. for that, mid 2018) but until then I'll just spend my time deleting over 1000 spam comments that have accumulated during my neglecting of this site.

:)

Inception - my views and theories

I wrote this ages ago, totally forgot it was still in my drafts folder. May as well post it now.

Inception is probably the best film I’ve ever seen; I've already seen it three times. I love films with this sort of plot and storyline and I think it was executed perfectly, plus the music was top class. There were a few things that confused me though; after some thought I’ve figured them out and these are the conclusions I’ve come to.

MyBB Support Team Lead

Damn, didn't I post this here??

At the end of March I was promoted to Support Team lead, replacing Dennis Tsang who had been doing it for years. This was totally awesome, something I'd been hoping would happen at some point but wasn't expecting to happen yet. I still remember when I first started using MyBB and knew nothing, but picked it up and worked my way to where I am now. I'll now be in charge of hiring new support staff, as well as overseeing support for the new 1.6 release when it's out. Rather looking forward to that.

Should be great.