Building Widget Sandboxes with Web-workers

JavaScript

For a new web application I’m working on I want to allow third party widgets to run within the application’s pages. Of course running arbitrary third party JavaScript on you app’s pages is not something you should do lightly as it can leave your users vulnerable to attacks by malicious widget authors.

Ideally you want to control the access that widgets have both to your user’s data and to page content. For example you want to remove unvetted access to the DOM and to the global window object. In this article I’ll describe the approach I’m taking.

Continue reading

Playing with Stylesheets

CSS JavaScript

I’m sure most of you are familiar with styling DOM elements using CSS selectors. But what if you wanted to create your own stylesheets on the fly or perhaps query or alter existing CSS rules on your page? That’s a little trickier, but also a bit of fun so let’s take a crack at it.

Continue reading

Making Markdown and Syntax Highlighting Gell with WordPress

Wordpress

It had been a while since I’d played around with setting up WordPress. I’d configured syntax highlighting for code snippets before but not together with using Markdown. But hey wouldn’t it be neat to write articles in Markdown? I’ve grown used to using it lately.

So I set out to see what I could get working. I didn’t expect it to take that long; how hard could it be? Well it turned out to be rather a pain in the neck; so I wrote this post to help you avoid that pain (and to provide a bit of a cathartic release for me!).

Continue reading

JavaScript Functions with Variable Arguments

JavaScript

You’ll often come across JavaScript libraries that let you pass different types and numbers of arguments to the same function call. This can be a really useful feature and it often makes your code easier to read.

So how do these libraries make this happen and how can you do this with your own functions? Take for example a function that sums a list of numbers.

Continue reading