Projects

In my spare time I like to build and publish open source software. Here are some of the things I've built

dbanon

Language(s):
  • Go

dbanon is a flexible, fast, dependency-less database anonymizer. I created it after researching available database anoymizers for Magento and not finding anything that worked to my liking (more details on that in this Twitter thread).

dbanon accepts a database dump via stdin, rewrites and anoymizes the text on the fly and sends the output back to stdout. As it’s written in go, it will run anywhere, including database servers that don’t have scripting languages like PHP installed. It is immediately compatible with Magento 2 out-of-the-box, but supports custom configurations to run it in any environment.

View on GitHub

pygments-high-contrast-stylesheets

Language(s):
  • CSS, Ruby

pygments-high-contrast-stylesheets is a hard fork of pygments-css with WCAG AA passing style sheets. I was inspired to build it when I ran a Lighthouse audit of this website and found that it failed the accessibility scan due insufficient color contrast in my highlighted coded blocks.

Initially I was converting the color values by hand, but later opted to build a Ruby script to automate the process. It works by obtaining the background color from the source stylesheet, then iterates through each CSS selector to determine if the contrast is sufficient and adjust as needed by either lightening or darkening the color until it reaches WCAG AA compliance.

I also wrote a Ruby script to generate a static HTML page with demos (in iframes) for each stylesheet converted.

Demos are published here.

View on GitHub

jekyll-pre-commit

Language(s):
  • Ruby

After routinely forgetting to do the small things when writing blog posts on this website, I built a Jekyll plugin which uses git pre-commit hooks to run checks before allowing users to commit changes to their Jekyll sites. Some things it can check…

  • Is your <title> and <meta name="description"> a good length (for SEO purposes)?
  • Did you forget to include anything in your front matter (for example forgetting to write a description)?
  • Are any of the values in your front matter duplicated (for example you copy / pasted them from another post)?

I built jekyll-pre-commit with extensibility in mind: In addition to the checks it ships with, users can write their own checks by placing them in their site’s _plugins/ directory.

View on GitHub

Mpchadwick_PageCacheHitRate

Language(s):
  • PHP

I built a Magento 1 plugin that allows users to monitor their page cache hit rate. It supports multiple storage backends for hit rate data including New Relic, Redis, or log file based.

It also includes many dimensions for drilling down into the data such as by route, hostname, or URL.

View on GitHub

SomethingDigital_InfluxDb

Language(s):
  • PHP

I built a Magento 1 plugin at Something Digital that pushes metrics from Magento to InfluxDb for tracking in time series. There are many metrics that it can be configured to push. Here are a few…

  • Cron execution history
  • Changelog table status
  • Full page cache size

Additionally, it includes a Measurement interface which user’s can implement to add push their own metrics to InfluxDb.

View on GitHub

tracking-query-params-registry

Language(s):
  • Markdown

Digital marketing tool such as email service providers and analytics platforms often append tracking parameters to URLs. These are helpful for marketers, but can also severely decrease the effectiveness of page caching tools such as Varnish.

tracking-query-params-registry is a centralized list of tracking query parameters used by the huge range of online marketing tools in use today.

The project source can be seen on GitHub and perused here.

View on GitHub

mod_log_header_size

Language(s):
  • C

I built an Apache plugin which adds % directives for logging request and response header sizes (in bytes). This was built in response to several issues I’ve seen where application code leads to header size limits being exceeded on both requests and responses. The module allows users to monitor and alert on header size.

View on GitHub

jquery.nonSuckyYouTubeEmbed

Language(s):
  • JavaScript

jQuery.nonSuckyYouTubeEmbed is a jQuery plugin designed to improve front end performance when working with YouTube embeds.

The plugin works by fetching the fetching a thumbnail image and overlaying a play button, and replacing the thumbnail with the embedded YouTube iFrame when only when the user clicks the play button. This is important always but especially important for sites the embed multiple videos on a single page.

I also took a deep dive on YouTube embeds in this blog post.

View on GitHub

Mpchadwick_SearchAutocompleteConfigmarator

Language(s):
  • PHP

Mpchadwick_SearchAutocompleteConfigmarator is a Magento extension I built that enhances the functionality of Magento’s out-of-the-box search autocomplete functionality.

It adds a few key features that are missing…

  • On/off switch
  • Result limit
  • On/off switch for result count
  • SQL LIKE match position

All these features can be configured through the admin panel (hence the “configmarator” name).

I was inspired to build this based on actual frustration I saw merchants having with the OOB functionality (especially the inability to control the result limit)

View on GitHub

ruby-whois-api

Language(s):
  • Ruby

ruby-whois-api is a basic Sinatra wrapper for the Ruby WHOIS gem.

My work on Domain Clamp forced me to do a deep dive on WHOIS parsing at which point it was pretty clear that the Ruby gem was the best solution available.

ruby-whois-api is a minimal web service that receives domain name and responds with a parsed WHOIS record.

View on GitHub

Mpchadwick_BigAssImageWarning

Language(s):
  • PHP, JavaScript

This project is partially a joke, but I’ve seen cases where this type of thing is actually needed. This is a Magento extension, the idea behind which is to alert store admins if they upload an image that is bigger than a predetermined threshold.

While at Something Digital I had seen a store admin who will remain unnamed upload a 7.2MB image to a blog post, which prompted me to build this…

View on GitHub

Open Source Contributions

I like to contribute back to the tools I use. Here are some of my open source contributions…

Featured Contribution: Memoize recurse regex in faker

Language(s):
  • Go

I identified that Faker was uncessarily calling regexp.MustCompile every time it was asked for a new value. I found that this was introducing major performance issues while profiling my project dbanon, which uses faker to anonymize a database. With an example dataset of 1 million users, and 4 faker calls for each user (First name, Last name, Email, and Password) compiling this regex was nearly 80% of the time spent across everything dbanon was doing. I fixed this by memoizing the *Regexp so that it was only compiled once. A simple change, but a big impact from a performance standpoint. The exact change and before and after profiles are available in the link below.

https://github.com/dmgk/faker/pull/23

PHP

Ruby

Docs

JavaScript

Go

HTML / CSS

ETC