Going Functional – Reduce

12 January 2013 by Tomas Brambora - Category: Technical Articles

Reduce (a.k.a. foldl) is one of my all-time favorite higher-order functions. It’s kinda sorta the crane stance of the functional style kung-fu: you don’t want to use it a lot but when you do it can save the day. Every now and then you come across an array and you want to combine its items somehow [...]


Going Functional: Map

7 January 2013 by Tomas Brambora - Category: Technical Articles

Let’s face it: the ‘map’ function (a.k.a. ‘apply-to-all’) is pretty simple. You just pass it an array and a function and it returns an array of results of that function applied to each item. What’s it all about then? Here comes the important bit: the new array will have the same size as the original one. Always. [...]


Adding a Toolbar Button in a Bootstrapped Firefox Extension

14 December 2012 by Matthew Gertner - Category: Technical Articles

Adding a toolbar button in a Firefox extension is simple. Since the Firefox user interface is described using XUL, it is enough to inject a snippet of XUL into the “toolbar palette” in browser.xul. Traditionally this would be done with a XUL overlay. Experienced XUL developers know that a button added like this won’t show [...]


Going Functional

7 December 2012 by Tomas Brambora - Category: Technical Articles

Introduction Take a look at the following piece of code. What’s wrong with it? myAwesomeFunction = (objects) -> isGreat = false for item in objects if not item.isImportant continue if item.isGreat isGreat = true break return isGreat Does it go through all the items? No but, man, is that break on the last line easy [...]


Igor Tandetnik’s Passthrough APP… Now on Github!

7 November 2012 by Matthew Gertner - Category: Technical Articles

One of the many frustrations things about developing extensions for Internet Explorer is that certain seemingly essential capabilities are completely lacking. For example, you can see the headers being send with an HTTP request using the BeforeNavigate2 event. But you can’t modify the headers. What’s more, this event is only received for page or frame [...]


RestQ

27 September 2012 by Tomas Brambora - Category: Technical Articles

Here’s a confession – over time I have come to like services that expose their data via a RESTful API. It’s scalable, it’s understandable and quite importantly – it’s elegant. Working with REST is a breeze, right? Well, a few weeks ago, I found myself facing a rather mundane task – retrieving all the information about [...]


Lexical Dispatch in JavaScript

29 January 2012 by Tomas Brambora - Category: Technical Articles

Using a big switch statement to fake polymorphism is evil. Everybody knows that. But how do you get rid of it? Let’s say you’ve got a method that receives a string describing some state (“normal”, “error” etc.). And depending on the value of that string (state) you want to react. If you ask around, an [...]


On Using Jasmine in xpcshell Tests.

19 November 2011 by Tomas Brambora - Category: Technical Articles

Jasmine is a JavaScript framework for supporting behaviour-driven development in your projects. Like most JS frameworks, when used for client side development Jasmine expects an environment that meets certain conditions (e.g. it assumes the existence of a global window object). In Salsita, however, we’re in the business of creating browser add-ons – which happens to [...]


Coding Conventions for Browser Extensions

11 May 2011 by Matthew Gertner - Category: Technical Articles

Douglas Hofstadter’s fabulous book Metamagical Themas includes an entire chapter musing on the “visual textures” of Chopin’s etudes and their relationship to the aesthetic impact of the music. Style matters in software code as well. I am reminded of a profile of Bram Cohen of BitTorrent fame, in which his wife claims that “…the code [...]


Packaging WebRunner Applications

18 April 2011 by Matthew Gertner - Category: Technical Articles

Probably the most frequent question I’ve been getting about WebRunner is how to package up web apps for distribution to end users. Many creators of Prism apps have been distributing them by creating an installer that places the Prism runtime (basically the entire Prism directory) and web app configuration files on the end user’s machine. [...]