Recently I got a request in the mail from a user of one of my Firefox add-ons. He asked me if I could make an add-on that displayed the url of the current tab in the titlebar instead of the actual title of the page being shown. I’m not interested in creating more add-ons for Firefox or Thunderbird, they take up quite a lot of time with user requests, getting approved by the Mozilla addons site, etc. That is why I’ve discontinued 6 out of the 9 add-ons I’ve created. But anyway, I knew that it would be trivial to make this add-on so I decided to help this person out. (more…)
Lately I have been doing some COM automation stuff on Windows. I’ve been using JScript (Microsoft’s JavaScript implementation) since that’s available on all Windows machines, and the other option, VBScript, is horrible. Normally I would use Python and the win32com package, but I needed to make some scripts that could work on any box without installing Python first. JScript is a pretty nice language, but it doesn’t come with a REPL built in, which is very handy when you’re doing experimental stuff (REPL = Read-Execute-Print-Loop). Now, writing your own REPL in a dynamic language with an eval statement is pretty easy, so I did just that. It took about 30 lines, of which about 10 are just about printing evaluated expressions nicely. (more…)
For those that just want to play the game already, go here to play it
The last few weeks my hobby project has been creating a cardgame in Javascript. I’ve always wanted to create a cardgame and I decided to use simple Javascript so I could make it available online since no-one wants to bother to download small games. I figured there were thousands of blackjacks and solitaires out there so I decided to create my favorite cardgame, Idiot. (more…)
Since I started creating Mozilla extensions I spent a lot of time writing boilerplate code, and copying from one extension from the next. Then I found Ted Mielczarek’s Extension Generator which is a great page that takes some parameters and creates an extension ready for you to use. I used that for some time but in the end I still kept modifying each extension to fit my own style and include my library functions. So I decided to make my own Mozilla Extension Generator in Python (more…)
Python has been my favorite language for a while but since I started making Mozilla Extensions I’ve started to like Javascript a lot too. One thing I miss from Python though are the format strings. In Python you can always create a string like this:
s = '%s is a %s' % ('John', 'Moron')
Since Javascript is a very flexible language and allows you to alter its built in types I decided to try to create something similar for it. Here’s what I came up with:
(more…)