Category Archives: Yada yada

Random stuff

Expensive JavaScript with Fibonacci

Many times while working with JavaScript I encountered situations where it was useful to have an expensive script that would run for a certain time (like 5 to 10 seconds) thus blocking the JavaScript thread. This is helpful e.g. when you want to simulate expensive server-side actions.

Recently I came across this (in hindight obvious) solution in the excellent book Beginning Node.js by Basarat Ali Syed (Apress, 2014): An unoptimized fibonacci function.
I will leave this here for future reference.

console.time('timeit');
function fibonacci(n) {
    if (n < 2)
        return 1;
    else
        return fibonacci(n - 2) + fibonacci(n - 1);
}
fibonacci(44);    // modify this number based on your system performance
console.timeEnd('timeit');

Hello world!

So this is my new blog C:\Temp. It will be about web standards or whatever else I deem worthy writing about. In the past I have found it very useful to note down tutorials or interesting links in the form of blog posts so that I can refer back to them later. I don’t like having tons of booksmarks (still have ‘em, though!) so this blog is a practical way of sorting these resources and knowledge – making this my main resource. And if sharing these things publicly helps anyone else out there – all the better!

As my daily work currently heavily consists of working with the portal software Intrexx I will mostly be writing about topics revolving around that. So there will be JavaScript/jQuery and CSS (also because I have the greatest interest in these technologies) as well as the occasional Velocity or Groovy code.

To start things off, here’s the Intrexx 5 logo, made entirely with CSS (no image). I made this on CodePen some time ago as an excercise to learn CSS gradients.

See the Pen Intrexx Logo with Gradients only by Christian Templin (@cianty) on CodePen.