A service worker is like a cookie. Cookies are downloaded from a web server and installed in a browser. You can go to your browser’s preferences and see all the cookies that have been installed by sites you’ve visited. Cookies are very small and very simple little text files. A website can set a cookie, read a cookie, and update a cookie. A service worker script is much more powerful. It contains a set of instructions that the browser will consult before making any requests to the site that originally installed the service worker.
A service worker is like a virus. When you visit a website, a service worker is surreptitiously installed in the background. Afterwards, whenever you make a request to that website, your request will be intercepted by the service worker first. Your computer or phone becomes the home for service workers lurking in wait, ready to perform man-in-the-middle attacks. Don’t panic. A service worker can only handle requests for the site that originally installed that service worker. When you write a service worker, you can only use it to perform man-in-the-middle attacks on your own website.
A service worker is like a toolbox. By itself, a service worker can’t do much. But it allows you to access some very powerful browser features, like the Fetch API, the Cache API, and even notifications. API stands for Application Programming Interface, which sounds very fancy but really just means a tool that you can program however you want. You can write a set of instructions in your service worker to take advantage of these tools. Most of your instructions will be written as “when this happens, reach for this tool.” If, for instance, the network connection fails, you can instruct the service worker to retrieve a backup file using the Cache API.
This is one of the best scenes in the whole movies history. And that’s because of the brilliant performance by Ronald Lee Ermey. Unfortunately, Ronald Lee Ermey has passed away on April 15, 2018, at the age of 74. He played a few more roles in other movies, but I think this is by far his best contribution to the cinema. Probably, because he was a drill instructor in the United States Marine Corps in real life.
Thank you, Ronald. Rest in peace.
Mailtrain is a self-hosted Open Source alternative to MailChimp and other similar mass-mailing and newsletter services. Of course, being self-hosted, it can go only so far – you’ll still need to deal with mail delivery, SPAM filtering, and other modern days “benefits” of delivering mass mailings. But it looks pretty complete in terms of features, so if you want to have full control and don’t mind investing a bit of time in setting up, check it out – you might get a better or at least cheaper alternative.
My WordPress radar noticed a new website – wpplugincheck. This website provides in-depth reviews of WordPress plugins. I’ve checked a few of those and they seem solid – honest and to the point.
There’s a gadzillion of websites online that review WordPress plugins (occasionally including even my own blog), but most of those either get too commercial with sponsored posts, or turn into collections of “5 best of this” and “7 awesome of this”. I hope the site continues and gets into a routine of publishing reviews of the new and updated plugins, especially focusing on the areas where there are a lot of choices, or not enough.
WordPress is an excellent system for a whole lot of different projects and needs. It’s widely used, fast, and flexible. However it does show its age in many ways. One of the areas where things could be a lot better and simpler is the WordPress plugin development.
WordPress plugins are still non-trivial to develop. This is mostly because WordPress is behind the current technology in many ways: new features of PHP programming language, such as Object-Oriented Programming (OOP), namespaces, dependency management with composer, unit testing, etc. There are good reasons for this, but those don’t help WordPress plugin developers.
What does help is, for example, this WordPress Plugin Boilerplate, which is a standardized, organized, object-oriented foundation for building high-quality WordPress plugins. Using it still requires a bit of effort and dumb find-replace changes. But it saves a tonne of time, as well as trial and error, especially for those people who are working on their first or second WordPress plugin.
“Parsing: a timeline” is a historical timeline of parsing, as done by computers and computer programming languages. It starts well before computers were actually invented, from the time where people started thinking about what is a language, what it consists of and how it works.
Even though this article is mostly aimed at technical people, I’m sure pretty much anyone will find interesting bits in there, as some of the names and works mentioned are well known outside of technical industries. For techies, you’ll find all your favorite names in there – Markov, Turing, Boehm, Chomsky, Knuth, Dijkstra, Wall, and more.
- Web components do not provide a solution to this problem.
- It’s not that hard to make your own framework using an existing Virtual DOM library. But I’m not suggesting you to do that!
Read the whole thing for some examples and explanations.
Here’s some CSS humor for you – Ninjas of Web Development: 30+ CSS Puns That’ll Crack You Up. Some of these are very obvious, some are very subtle.
With Accelerated Mobile Pages (AMP) being all the rage recently, I found “How fast is AMP really?” article interesting. It looks like it’s worth spending a tiny bit of time adding AMP to your site, especially if it was developed with one of the common and widely used tools, like WordPress. And if mobile page performance is important for your project, than there’s even more that you can benefit from.