Migrating Blog - 2

Migrating Blog - 2



Just thought i would link to my migrated blog as I work on it, the DNS address is: http://craigpayne.no-ip.org/ If you browse using your phone, it should look very similar to in the browser.
Here is an iframe version.
If nothing shows up, my raspberry pi has probably crashed or something!
Domain Name

Domain Name

Since I'm never going to be able to get http://craigpayne.co.uk, I've opted for http://craig-payne.co.uk. Maybe google will index me now i dont have a .info name!!


Migrating blog

Migrating blog

I've spent some time working on migrating this blog over to my raspberry pi.
I thought I'd do something a bit different, so first of all I built up the UI to make a responsive design. It looks the same on my laptop as it does on my android and itouch! I then decided that I would host it using node.
I have created my own web server, that renders pages and posts using jade templating engine. It works well, although its still work in progress. Its certainly not ready to swap out my blogger account yet! Check it out: https://github.com/erroroccured/craig-payne-blog


Home Made Jade Web Server

Home Made Jade Web Server

I have been playing around with Node.js again, and have create a Jade web server.
Jade is a html templating engine similar to haml, that allow you to write html without all the extra syntax
e.g.

Valid Jade markup:
html
 head
 body
  div Hello World

The node module I have created is quite simple, it defaults to index.html if a template is not specified. templates can be loaded by using the query string key 'page' e.g. http://localhost:8080?page=about This will translate to about.jade template on disk.
I need to add support for loading local variables, i could do this using query string, but its not practical. maybe by using a post request? who knows! I need more of a think.
Here is the module i wrote: Dependencies - http,jade,fs,url
var http = require('http');
var jade = require('jade');
var fs = require('fs');
var url = require('url') ;
var options = {pretty:true};

http.createServer(function (req, res) {
 var query = url.parse(req.url, true).query;
 console.log(query);

 if(!query || !query.page) {
  //Show Index Page
  fs.readFile("index.html", function read(err, data) {
   if (err) console.log(err);
   res.writeHead(200, {'content-type': 'text/html'});
   res.end(data);
  });
 }else{
  var template = query.page + ".jade";
  fs.readFile(template, function read(err, data) {
   if (err) console.log(err);

   var markup = jade.compile(data, options)({});
   res.writeHead(200, {'content-type': 'text/html'});
   res.end(markup);
  });
 }

}).listen(8080);



blackout.js

blackout.js

I got sick of building snippets of javascript to block out sections of webpages when ajax calls are made etc. I built a jQuery plugin to do this for me, it should be cross browser compatible. Makes life a little bit easier. GitHub: blackout.js


PicoContainer / Mono Droid

PicoContainer / Mono Droid

Reverted back to Windows 7 this weekend (finally removed windows 8!!) and did some development. I started looking at Mono Droid. I really like it, Its a lot faster than i expected it to be!! I started working on a shared library, so that I can write some boilerplate code, ready for when I have an application idea. So far I have been working on a Read Only file picker. My shared application logic uses PicoContainer for dependency injection, as it is a small and lightweight implementation of IOC. The app works well! You can download it from my github to try it out! Github Signed APK