Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @name Canvas Tracking Blocker
// @namespace ctb
// @description Monkey patches toDataURL for canvas to make it non-deterministic
// @include *
// @version 1
// @grant none
// @run-at document-start
// ==/UserScript==
var toDataURL = HTMLCanvasElement.prototype.toDataURL;
@jvatic
jvatic / pre-commit.rb
Created May 16, 2012 16:00
Git pre-commit hook to block committing Spec files with :focus => true on test blocks
#!/usr/bin/env ruby
# vim: set syntax=ruby
flag = false
files = `git diff --cached --name-only --diff-filter=ACM | grep "_spec\.rb$"`.split("\n")
files.each do |file|
results = `git diff --cached #{file} | grep "^\+[^+]" | grep ":focus => true"`.split("\n").map { |r| r.sub(/^\+[\s\t]*/, '') }
if $? == 0