Category Archives: davidwalsh

Checkout the Last Public Revision with Mercurial

I’ve always preferred git over Mercurial (hg) because the feature branch workflow makes organizing code and working off of master very easy. You don’t get that with vanilla mercurial — instead, commits can just sort of apply on top of each other, without much organization. Sometimes mercurial can feel a bit chaotic.

When working on Mozilla’s mozilla-central repository (for your beloved Firefox!), I always start new commits off of the latest public commit. “public means it has been merged into mozilla-central, “draft” means it was created locally and is only on my machine.

read more

How to Detect Text in Images

Images are a great way to communicate without text but oftentimes images are used/abused to spread text within social media and advertisements. Text in images also presents an accessibility issue. The truth is that it’s important, for any number of reasons, to be able to detect text in image files. The amazing open source tool that makes detecting text in images possible is tesseract OCR!

read more

Detect if Element is a Web Component

I’ve advocated for web components since before they became a spec, mostly inspired by the Dojo Toolkit’s dijit framework. Empowering first class JavaScript widgets, as opposed to a mess of DIVs and templates, always made the most sense. Now that web components exist, and awesome frameworks like Ionic are based on them, I wanted to discover how to detect a web component, as opposed to a regular HTML element, with JavaScript. As it turns out, it’s much easier than you’d think.

read more

IP Geolocation API

Detecting geolocation information from your user provides you a massive advantage: improved conversion, better segmenting and analytics, and providing more relevant content. There are numerous paid services which will provide geolocation info but they’re oftentimes too costly or short of valuable information. I was super impressed with IP Geolocation API, a free geolocation API that provides extra details like languages spoken and currency code!

The URL format for IP Geolocation API is simple:


The response payload look like:

   "continent":"North America",
   "address_format":"{{recipient}}\n{{street}}\n{{city}} {{region_short}} {{postalcode}}\n{{country}}",
   "name":"United States of America",
   "subregion":"Northern America",
      "United States",
      "Vereinigte Staaten von Amerika",
      "Estados Unidos",
      "Verenigde Staten"

read more

Wix Is Challenging You to an SEO Battle for $25K (Sponsored)

This year Wix launched a series of advanced SEO tools for Wix users to optimize their site pages for search engines and social media platforms. These tools include custom meta tags, canonical URLs, 301 redirects, structured data and rapid loading.

So what’s the deal?

To put their new SEO tools to the test they’re challenging Wix SEO Lovers and Haters to an SEO Battle for $25K. The challenge is open to agencies and consultants who will be chosen and judged by SEO and social media marketing expert, Lukasz Zelezny.

read more