This is an archived copy of all my blog posts which is irregularly updated.
  • Simple function logger in JS

    Every now and then I end up in a code base where I don't have a clue about the flow yet; like today when testing out the new keyboard application that we're developing for Firefox OS. To see whether the flow is actually sane I plug in a simple function logger that allows me to see which functions are called and with what arguments.

    Continue reading »

  • Simple async queue in javascript

    Normally I fall back to caolan's async module, but I'm not in a node.js environment and I needed a simple async queue with concurrency 1; which can be done in a one liner.

    Continue reading »

  • Getting started on Firefox OS apps with AngularJS

    The part that amazes me most about working day to day with Firefox OS is the incredible way that the existing web eco-system can be reused to target mobile phones. We have seen this with using Weinre to remote debug the FFOS system, using emscripten to cross compile C code into javascript, or just the ease of reusing jQuery within your Firefox OS app; something that I would have killed for back in the days when doing WPF.

    Continue reading »

  • A decent terminal experience on Windows

    Two years ago I would've never guessed that I would be completely hooked on using the terminal. However, after moving to an operating system that had a decent terminal underneath I soon became a command line junky. Time to improve the retarded beast that they call 'cmd.exe' in Windows by adding some real terminal experience.

    Continue reading »

  • Node.js's null terminator of death

    Recently we embraced our new 'review for security' strategy, that included a security 101 given by yours truly and a very big messages like 'Don't reinvent the fucking wheel'. Just saying.

    http://100procentjan.nl/tweakers/dontwheel.png

    Working on this subject intensively also learned me to really really test for security. Developers, and I'm not an exception here, are focussed on code quality, feature stability and security is not always on their radar. And that's a shame because reviewing for security really gives you this 'Dade Murphy' hackers feeling. Meet me at the 'null terminator of death'.

    Continue reading »

  • Building Wordpress sites in the cloud

    As part of the new features that we launched two weeks in Cloud9 IDE we've added support for Python, Ruby and PHP as server side languages besides node.js. That's not just it, because users have full freedom over the VM that we run your code on so they can install any platform they like (C++ development in the cloud f.e.). The cool thing is that it's now possible to bring all sorts of already existing applications into Cloud9, without relying on third parties to do the actual Apache hosting etc. because you'll just get an Openshift server. In this post I'll show a step by step demo of how to use Cloud9 to build a Wordpress application without leaving the browser.

    If you want to see the quickest demo possible, sign up for Cloud9 at c9.io, log in via GitHub and create an index.php file:

    <?php
    echo 'Hello world'


    When you now click the 'Debug' button we spawn a shell version of PHP that echoes 'Hello world' back to you. To run it via Apache go to the run panel, select 'Apache+PHP' and re-click 'Debug'.

    http://100procentjan.nl/tweakers/wp1.png

    Continue reading »

  • Rate limited website scraping with node.js and async

    So yesterday a job description at my previous employer popped up in my facebook stream which reminded me of the programming excercise that we included in the interview process just before I left the company. In short it comes down to:

    • Funda has an API that lets you do queries, the response is paged, max. 25 objects at a time
    • The API is rate limited at about 100 req./minute
    • Request all pages for a given query
    • Count the times a realtor ID is in the result
    • Aggregate and sum the realtor ID's and create a top 10 list of realtors with the most objects
    Scraping this is pretty easy, but the rate limiting got me thinking. A great library for doing queue work like this (create a large list of URLs to scrape, then do it 4 at the same time or something) is async by caolan, but it lacks real rate limiting. Room for improvement!

    Continue reading »

  • Inheritance in javascript

    Inheritance in javascript blijf verdomd moeilijk, zoals ik deze week weer tegenkwam toen ik een vriend hielp in het porten van wat AS3 code naar javascript. Vandaar wat ready to use code snippets en een kleine uitleg om inheritance toe te passen.

    Javascript kent een aantal manieren om code te mixen, maar ze zijn globaal onder te verdelen in inheritance en mixins. Inheritance is prettig voor een object structuur die je in een taal als Java of C# zou schrijven. Single inheritance van classes, als in Object->GameObject->Person->Enemy. Elk van de parent classes zou ook los kunnen bestaan, en de classes mogen zelf state bijhouden. Mixins hebben meer weg van abstracte classes, en zijn bedoeld om behavior te laten erven, sla er dus geen state in op want dan loop je tegen scoping issues aan. Je kunt meerdere mixin's in 1 object mixen voor multiple-inheritance-like behavior.

    Continue reading »

  • Live file sharing met socket.io en node.js

    File uploading is altijd een pain in the ass geweest, upload limits, geen progress informatie, geklooi met Flash plugins voor multiple file selection. Gedoe. Maar nu hebben we de File API, socket.io en node.js. Alvast filmpje van het eindresultaat:

    Video

    Continue reading »

  • Nerd tshirts met obfuscated javascript

    Het begin:



    http://www.100procentjan.nl/tweakers/c9_tshirt.png


    Het resultaat (uitvoeren in Chrome of Firefox console):

    __=!($=[$=[]])+$;_=$[$]+'';$_=({}+$);$_[-~(($=-~$)<<-~$)]+__[-~$]+$_[$]+_[~-$]+_[$=-~$]+(($<<$)+~-$)

    Geinspireerd door deze blogpost nu zelf maar eens bezig geweest met het (expres) obfuscaten van javascript.

    Continue reading »