Google’s ReCaptcha not appearing?

Recently I had a weird problem that Recaptcha has not rendered at all in most of the cases. It seemed random however, but most of the cases it failed. Later I’ve figured out, that it was caused by some network race conditions. The solution was then quite straightforwad: manual initialization of ReCaptcha after the script has …

How to call any function as a $filter in AngularJs

Recently I had this little trouble. I had a simple angular controller, which filtered some array of items. I did not want to define the filter in a “global space” because I knew it will be used only by this one controller. So this first thing was to define the custom filter function. Like this …

How to unit test Angular’s $resource and $http

Unit testing of Angular’s underlying $http can be very tricky. I’ve some spent considerable time to get the unit testing up and running. What was running OK in a live application, was not working at all in a unit test. I was getting error message “No pending request to flush !” all the time. My …

Jak jsem si zamiloval TDD

Jako asi každý vývojář, jsem i já četl o tom, jak je důležité psát unit testy. Občas jsem nějaké psal, ale nebylo to dostatečné. Na posledním projektu, kde vývoj trval zhruba rok a půl, jsem začal unit testy psát až během posledních několika měsíců. Což bylo sice ostudně pozdě, ale lepší než nic. (Jednalo se …

Function string.format ported from .NET to AngularJS

Have your ever wondered if there something like string.format() method as known in .NET but available in Javascript? And waht about AngularJS? The answer is yes. Guys from Microsoft wrote library Ajax Control Toolkit, containing little this gem String.js (I found it via Stackoverflow). I needed it as a filter in AngularJS, so I have ported …