Code

Apart from work related development in Lotus Notes, some web projects in Joomla, and a brief flirtation with PHP, I suspect I have neglected a longstanding interest in coding. This section of the site is something like an experimental sandbox / journal of personal projects.

Not surprisingly there is wealth of useful 'coding' resources online and I'm also following a variety of courses via CodeSchool and Lynda. Both are very good, and I think CodeSchool is particularly helpful, with it's mix of video and interactive sections... plus the annoyingly catchy jingles!

Personal Projects

Restore Social Media Icons Hidden by Ad Blockers

I've been noticing my Adblock solution of choice seems to have been becoming somewhat more aggressive lately, even blocking tiny "logo" PNG images in the footer of my sites, and sometimes even blocking completely innocuous images, simply because the word "social" features within the ALT tag. I fully agree visitors should be able to block active social media content, etc, but it seems not unreasonable that I might want to display a Twitter handle in the footer of a website. I wrote up a short explanation of how I reclaimed my icons! Link here: Social Media Icons vs Adblock Et Al. 26/3/2015

  Read more...

Embed JSON within a Markdown file (PHP)

There are existing solutions for this, but as I was already extensively using the Michel Fortin PHP Markdown Library, it seemed easier to add the functionality locally. In its typical config, $text (the unprocessed Markdown) is translated into $html (the formatted HTML), and I have an additional PHP function splitting $html further into $body (the HTML to be displayed) and $json (the JSON to be used internally). It's simple and functional, and I'm currently using it to keep metadata (page title, description, keywords, etc) together inside the Markdown files. In addition, on the DTV CRC Website I'm using the same approach to bring in latitude/longitude and other mapping info for the "contact" pages. 1/6/2014

Read an email, extract JSON from 'body', import to CouchDB (PHP)

I wrote this as a proof-of-concept, to import a limited subset of data from a closed system (running in Lotus Notes) into a secure website, but where it was not possible to simply POST the data. Using the same PHP function as my Markdown/JSON script above, it seemed technically feasible to email some JSON (in this case to a 123reg email address) reading that message via the imap_fetchbody function, extract a block of JSON from the email body, and finally PUT it to CouchDB. It works fine, periodically searching for emails where the UNSEEN flag is set, but the import function is currently manipulating the JSON prior to sending it to Couch, and I'd prefer it to be more generic; so that it doesn't need to know what "fields" are being imported. 28/9/2014

Logging Car Journeys (including journey cost) to a Google Spreadsheet

This is a solution based around a bluetooth OBD-2 device, Dash for Android, IFTTT, and Google Sheets. I've written the following short article describing the set up: Logging Journeys with Dash and IFTTT. 8/7/2014

  Read more...

Minecraft Server Status Page (PHP)

Having recently built an Ubuntu 14 based Minecraft server, I wanted a site where friends could easily check the status of the server. The following link to the page includes the PHP code used for the status "alert" panel. Minecraft Server Status Page. 27/10/2014

JavaScript and jQuery

jQuery Sums - Simple randomised maths quiz. 26/4/2014
Fizz Buzz Test - JavaScript implementation of Fizz Buzz. 25/6/2014

Websites

Jonathan Craddock (dot com) ongoing
ARCC North East Website (mirror) - Simple HTML holding page using Bootstrap. 4/3/2014
DTV CRC Website - Template uses Bootstrap, and content served using a simplified version of this site's flatfile CMS. 1/6/2014
Clean-Cut Scissor Sharpening - Responsive design, static content, with contact and order forms. 1/3/2015


I have moved all my hosting to Digital Ocean; fantastic service at a great price. I'd wanted a Virtual Private Server for a while, but was put off by the cost, until an advert on Coder Radio brought them to my attention. Their prices start at about £3 per month. There's a great choice of Linux builds and single-click app installs. I had an Ubuntu LAMP server spun up in less than their advertised 55 seconds! Their intro level $5 package gets you 512mb, 20gb SSD, single core, 1tb transfer, and I chose their London datacentre. Get $10 free credit with this link.

In the interest of full disclosure, I get a reciprocal payment if you sign up with this link, but I wouldn't be recommending them if I hadn't found it to be a great service!
;-)

  Disqus currently not enabled on this page...