Skip to content

Instantly share code, notes, and snippets.

View rwaldron's full-sized avatar

Rick Waldron rwaldron

  • Boston, MA
View GitHub Profile

Inspired by Robert O'Callahan's blog

To reduce the need for "visual confirmation" tests:

  • store the base-64 encoded data-uri of a reference png as a string
  • copy the outerHTML of your test fixture into an SVG wrapper, prefixed with "data:image/svg+xml,"
  • set the src of an image to the value of the SVG wrapper
  • copy the image into a canvas context
  • assert equality of canvas.context.toDataURL() and previously stored reference string
@joshuaclayton
joshuaclayton / gist:721214
Created November 30, 2010 05:36
Homebrew-installed Python with pyobjc-core and pyobjc
I use Homebrew and wanted to install pip for mercurial. Pip requires a homebrew-installed version of Python, which is fine and dandy; however, I noticed that webkit2png was broken after I installed Python with Homebrew (it was missing pyobjc libs, which comes with the OS X Python install by default).
This assumes that the current homebrewed version of Python is 2.7.1 and that homebrew is set up for /usr/local. If that's not the case, you may have to change the minor version of setuptools (e.g. from 2.7 to 2.8) and change the PATH accordingly.
$ brew install python
Modify your PATH to include the path to Python's bin directory:
export PATH="/usr/local/Cellar/python/2.7.1/bin:/usr/local/bin:$PATH"