A few years ago, I decided to try my hand at the Advent of Code problems in Rust, as a way to help me learn the language. One of the things I like to do in Rust (which I also liked to do in Python) is make heavy use of iterators, so when I come up against a problem like this, I reach for them first!
So, itʼs been a couple of weeks, and thought I might write a few notes on how itʼs been going…
As I mentioned in a previous post, I wasn’t really excited by the new MacBooks that were announced this year. And the more I read the less compelling they seemed… As I talked with my co-workers, I heard some really good reviews of a couple of models of Windows computers, and since 90% of Firefox’s users are using Windows it’s probably not such a bad idea if I use it, too, both to help me understand the problems they’re running into, and to make sure that the code I’m writing will work for them.
Iʼm writing a series about switching to Windows, and thought it would be nice to have a summary post, with links to all the other ones.
I was listening to episode 193 of the Accidental Tech Podcast, and one of the hosts didn’t seem like he understood why I (and apparently many other people on Twitter1) were uninterested or annoyed or disappointed with the new MacBook Pros. So, being a random white dude on the Internet, I hoped that I could leave a comment explaining the various reasons, in case he was interested… 🙂
(This article is also posted on Mozilla Hacks.)
You might have heard about Mozilla’s WebExtensions, our implementation of a new browser extension API for writing multiprocess-compatible add-ons. Maybe you’ve been wondering what it was about, and how you could use it. Well, I’m here to help! I think MDN’s WebExtensions Docs have a pretty great definition:
WebExtensions are a new way to write Firefox extensions.
The technology is developed for cross-browser compatibility: to a large extent the API is compatible with the extension API supported by Google Chrome and Opera. Extensions written for these browsers will in most cases run in Firefox with just a few changes. The API is also fully compatible with multiprocess Firefox.
The only thing I would add is that while Mozilla is implementing most of the API that Chrome and Opera support, we’re not restricting ourselves to only that API. Where it makes sense, we will be adding new functionality and talking with other browser makers about implementing it as well. Finally, since the WebExtension API is still under development, it’s probably best if you use Firefox Nightly for this tutorial, so that you get the most up-to-date, standards-compliant behaviour. But keep in mind, this is still experimental technology — things might break!
Okay, let’s start with a reasonably simple add-on. We’ll add a button, and when you click it, it will open up one of my favourite sites in a new tab.
Six years ago, I started contributing to Mozilla.
One of my favourite upcoming features in ES6 is Template Strings. I’ve used JQuery’s templates in some previous code I’ve worked on, and while it was very useful in finishing the feature on time, it’s aged now and relying on third-party libraries which we don’t have time to keep up to date isn’t the best idea and so we’re in the middle of some work to remove them. So having said that, I’m quite happy to see something similar arriving in the base language, so that we can take advantage of it without having to add any extra code.
As an aside, all the code below was tested in Firefox 34, using the Scratchpad. The comments are pasted in below the code when you select it and choose the
Execute » Displaymenu item or hit
Cmd+Lon Mac). I hear they also work in Chrome, but they didn’t seem to in the version I was running (39.0.2171.95), and I didn’t want to start messing with an
--es-stagingflag. If someone can confirm whether they work or not, I would certainly appreciate it! :)
Well, I managed to spend New Year’s Eve lying sick on the couch, and then went to bed semi-delirious from lack of sleep at 12:08, which kind of sucked, but I’m still hopeful that 2015 will be better than 2014 was. I mean, it almost has to be, right?
Anyways, my first, and so far only, resolution is to consume less and create more. When I look back on the year, I find I have spent more of my free time than I’ld like passively consuming other people’s content instead of making new things of my own, and that kind of bothers me. I’m very glad that a large part of my job involves making things, and that has definitely been rewarding, but there are also a lot of personal projects I want to start or finish or just push forward. And it doesn’t have to be code. I’ld like to write more blog posts, to explain the things I’m doing, and why they interest me enough to spend time on.