• All open issues on my github repositories

    Date: 2014.03.13 | Category: git

    I wrote a quick little script that turns all my open github issues onto clickable links..

    Copy paste the below into githubIssues.js:

    // Edit me
    var username = "YOURUSERNAME";
    var password = "YOURPASSWORD";
    // stop Editing!
    var gittub = require("node-github");
    var github = new gittub({version: "3.0.0"});
      type: "basic",
      username: username,
      password: password
      user: "JohnMcLear",
      filter: "subscribed",
      per_page: 100,
      sort: "created",
      direction: "asc"
    }, function(err, res) {
      for(var issueKey in res){
        var issue = res[issueKey];
        var line = "<div class='issue'>";
        line += issue.created_at + " ";
        if(issue.repository) line += issue.repository.full_name + " ";
        line += "<a target='_blank' href='"+issue.html_url+"'>";
        line += "+issue.title+"</a>";
        line += "</div>;";
        if(issue.title) console.log(line);

    Edit your username and password then type:

    npm install node-github


    node githubIssues.js &gt; issues.html

    Open issues.html in your web browser..

    Limitations: Max 100 issues due to Github API limit.

  • Adding i18n to a Cordova App

    Date: 2014.02.14 | Category: cordova, developer, developing, development

    i18n (Internationalization) in applications roughly means adding support for translations and other languages.  In this blog post I will talk you through a general approach to implementing i18n in Cordova Apps.  If your app isn’t open-source, move along, the 90s is on another website.

    As Cordova apps are written in HTML/CSS/JS we can easily leverage existing web platforms and services to provide i18n at break-neck speeds.

    TLDR Services/frameworks used:
    * Translatewiki to provide translations
    * Marcel’s html10n i18n implementation
    * Handlebars for templating
    * Etherpad implementation of detecting locale/language also written by Marcel

    Implementation steps

    * Ensure your app fulfills Translatewiki’s requirements (Open source etc)
    * Talk to Translate / Internationalization team at Wikimedia foundation before creating Gerrit commit
    * Gerrit commit to TranslateWiki adding support for your App.
    * Include handlebars and html10n libraries in your app
    * Modify your HTML putting markup in handlebar script tags
    * Move your text strings into locales files.
    * Include a handlebars html10n render helper
    * Use the Etherpad implementation of detecting locale/language* Give someone at WMF access to commit to your Repo

    Sit back and enjoy..

    Once you have completed your implementation and it’s approved by the WMF the WMF translation team will translate all of your strings and commit them back to your repo. You might want to provide the WMF team with the ability to see each of your strings in situ in a browser, this means providing a mechanism to fake Cordova events..


    This implementation is basically a straight copy of how we handle i18n in Etherpad, it’s pretty robust and clean to implement. All in all a complete refactor of the NFC Ring Control App while implementing i18n took about a week of full time commitment, well worth doing as now the larger community can provide translations which if I was to do hans solo would take months icon smile Adding i18n to a Cordova App

  • Cordova Windows Phone 8 Exit Application

    Date: 2014.01.23 | Category: cordova

    If you have a Phonegap/cordova app that goes from page1.html to page2.html then follows a link back to page1.html the standard backbutton behavior wont exit the app.

    Page1 >> Page 2 >> Page 1 — Windows Phone will take you to page 2 instead of exiting the app. It’s expected behavior but it’s kinda poorly documented..

    Anyway I searched around for ages but didn’t find a fix that worked for me..

    Diff friendly folks see the commit that includes this fix

    TLDR of how I fixed this is to use a JS value to track which page I’m on..

    IE in page1.html you could have..

    var currentPage = "index";

    Then in your app.deviceready function include..

    if(currentPage == "index"){
      document.addEventListener("backbutton", handleBack, true);
      document.addEventListener("backbutton", handleBack, false);
    function handleBack(){
      // handle other logic here such as handling the back events from page2 to page1..

    The real magic here is history.go(-(history.length-9999)) which basically tells the history stack to reset. Also the true statement on addEventListener allows the original registered event to fire (Native back button)..

    Anyway give it a try and let me know if it works for you.

  • Getting started with Explore NFC on Raspberry Pi in 60 seconds (Also Raspbmc)

    Date: 2014.01.20 | Category: nfc, nfc ring

    The docs from NXP are slightly over verboose, here I make the assumption you already have a Pi installed and know a little about SSH and using the Linux Terminal. It’s worth noting I’m doing some of these steps on Raspbmc too so things may differ slightly from your environment. I will try cover both wheezy and Raspbmc

    Put module onto Raspberry Pi by y’know, putting it on the Pi.. Reboot..

    SSH into your Pi username pi, password raspberry
    ssh pi@your-pi-ip-address

    Update your Pi and install some deps
    SPI was added late 2013 so it might not be available in your Kernel, doing an update is easy, do..
    sudo apt-get update && sudo apt-get upgrade && sudo apt-get install ca-certificates git-core cmake
    – Make a cup of tea

    cd ~ && sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update
    sudo chmod +x /usr/bin/rpi-update && sudo rpi-update
    sudo ldconfig

    Note: If you get a prompt saying you might not need this firmware or it’s the wrong update then just skip this step.

    Enable SPI (not required on Raspbmc)
    sudo nano /etc/modprobe.d/raspi-blacklist.conf
    – Comment out blacklist spi-bcm2708
    – Change it to read (note the hash)
    # blacklist spi-bcm2708

    Enable Pi on Rasmbmc
    sudo boblightd
    For posterity further information about this fix is on this thread — Note that sudo boblightd toggles SPI pins so running it twice might not work..

    sudo shutdown -r now
    – Make a cup of tea

    Grab the demo polling app from my Git Repo of the NXP S/W
    cd ~
    git clone https://github.com/JohnMcLear/NXP-Raspberry-Pi-Card-Polling-Demo.git
    cd NXP-Raspberry-Pi-Card-Polling-Demo
    cmake source

    – Make a cup of tea

    sudo ./card_polling

    My end goal here is to use my NFC Ring to start/play/pause videos in xbmc using the Pi shield.. Wish me luck..

    Q: I get Failed to open bal.
    A: You forgot to run card_polling as sudo.. sudo ./card_polling

  • Crest SVG

    Date: 2014.01.18 | Category: Uncategorized

    Cookies go to Gareth Pullen who figured out why the text wasn’t showing properlycoat of arms mclear crest 550x417 2 Crest SVG


- My Brain made this.