Tag Archives: javascript

Obfuscating mailto and tel links

When I designed my programmer’s portfolio site one of the things I noted it needs was my contact information. One alternative to doing that is a contact form, which has the advantage of avoiding spam from being sent to your e-mail address. However, I also found it very unnatural compared to having it open the user’s e-mail client or phone client. The `mailto:` and `tel:` links are the standard practice for contact information links, but it has the flaw of spam bots extracting the information and storing it for robocalls in the future.

So I get around it by obfuscating the links and text so that these bots would have a slightly harder time of getting the data.
Continue reading Obfuscating mailto and tel links

Converting a VBA collection to a JavaScript array

Windows Scripting Host allows you to access VBA Collections which are used by many objects in the Excel object model such as `ThisWorkbook.Worksheets`. Unfortunately VBA collections are not JavaScript arrays so you don’t have access to some of the more useful polyfills. To get around this I loaded up the `Array.from` polyfill into my project and created the following function:

Array.fromCollection = function (collection) {
    return Array.from({ length: collection.Count }, 
      function (k, v) {
        return this(v + 1)
      }, collection)
}

This will then give me the capability of doing the following with the `Array.forEach` polyfill.

Array.fromCollection(ThisWorkbook.Worksheets)
  .forEach(function(worksheet) {
    WScript.Echo(worksheet.Name)
  })

Publishing Meteor Application API documentation

For Java projects, JavaDoc has been the standard tool to generate API documentation. On JavaScript/Meteor frameworks, there isn’t a standard one and there are several different projects that try to support it, though the tagging is pretty much the same as JavaDoc. When developing an application, it is generally a good idea to have some form of API documentation generation as part of your development workflow; Meteor is no exception. This post talks about using `gulp` along with a documentation generator tool for a Meteor project.
Continue reading Publishing Meteor Application API documentation